diff --git a/doc/configuration.toml b/doc/configuration.toml index c746bbe..46ba3f0 100644 --- a/doc/configuration.toml +++ b/doc/configuration.toml @@ -1,3 +1,5 @@ +# In this file, the value of each configuration option is its default. + [links] # The prefix to apply to all internally-generated URLs. Default is "/". prefix = "/" @@ -11,3 +13,7 @@ directory = ".dragonglass.tmpl" default = "default.html" # The name of the default stylesheet. stylesheet = "dragonglass.css" + +[metadata] +# If true, use page title as default description. +description-title = false diff --git a/doc/metadata-values.txt b/doc/metadata-values.txt index cc64c48..25ed5f7 100644 --- a/doc/metadata-values.txt +++ b/doc/metadata-values.txt @@ -5,6 +5,10 @@ aliases List of alternative names that can be used to link to a particular page. +description + (Obsidian Publish standard metadata) + The description for this page. + publish (Obsidian Publish standard metadata) If this boolean value is False, the page will not be published. diff --git a/doc/template-vars.txt b/doc/template-vars.txt index 137b731..f39355b 100644 --- a/doc/template-vars.txt +++ b/doc/template-vars.txt @@ -8,6 +8,9 @@ default_stylesheet The filename of the default stylesheet which is generated by dragonglass and added to the generated pages. +description + The description of this page. May be empty. + dragonglass_version The version number of dragonglass. diff --git a/src/dragonglass/config.py b/src/dragonglass/config.py index e6b6b73..c3c7d65 100644 --- a/src/dragonglass/config.py +++ b/src/dragonglass/config.py @@ -59,11 +59,16 @@ class Context: self._default_template_name = templates_section.get("default", DEFAULT_TEMPLATE_NAME) @property - def url_prefix(self) -> str: - """Returns the configured URL prefix for all URLs generated for internal links.""" - links_section = self.config.get("links", {}) - rc = links_section.get("prefix", "/") - return rc if rc.endswith("/") else rc + '/' + def default_stylesheet(self) -> str: + """Returns the default stylesheet name.""" + templates_section = self.config.get("templates", {}) + return templates_section.get("stylesheet", DEFAULT_STYLESHEET_NAME) + + @property + def description_title(self) -> bool: + """Returns ``True`` if we use the title as the default description, ``False`` if not.""" + metadata_section = self.config.get("metadata", {}) + return metadata_section.get("description-title", False) @property def relative_links(self) -> bool: @@ -74,10 +79,11 @@ class Context: return links_section.get("relative", False) @property - def default_stylesheet(self) -> str: - """Returns the default stylesheet name.""" - templates_section = self.config.get("templates", {}) - return templates_section.get("stylesheet", DEFAULT_STYLESHEET_NAME) + def url_prefix(self) -> str: + """Returns the configured URL prefix for all URLs generated for internal links.""" + links_section = self.config.get("links", {}) + rc = links_section.get("prefix", "/") + return rc if rc.endswith("/") else rc + '/' def get_template_name_for_node(self, node: SourceNode) -> str: """ diff --git a/src/dragonglass/template.py b/src/dragonglass/template.py index e822908..1549e58 100644 --- a/src/dragonglass/template.py +++ b/src/dragonglass/template.py @@ -17,6 +17,10 @@ DEFAULT_TEMPLATE = """