feat: normalize config context and template API
Add FeedConfig and SitemapConfig structs to config.rs
with enabled: bool (default true) for opt-out control.
Refactor ConfigContext: flat nested_nav bool replaced
with nested nav: NavContext { nested, toc } to mirror
site.toml [nav] table structure.
Remove standalone base_url template variable; use
config.base_url as single source of truth with
trailing-slash trimming in ConfigContext::from().
Add section template fallback: try section/<type>.html,
fall back to section/default.html for unknown types.
Delete section/features.html (duplicate of default.html)
and homepage.html (dead code, never referenced).
Update base.html for new variable names.
This commit is contained in:
4
docs/templates/base.html
vendored
4
docs/templates/base.html
vendored
@@ -7,7 +7,7 @@
|
||||
{% if page.description %}
|
||||
<meta name="description" content="{{ page.description }}" />{% endif %}
|
||||
<title>{{ title }} | {{ config.title }}</title>
|
||||
<link rel="canonical" href="{{ base_url }}{{ page_path }}" />
|
||||
<link rel="canonical" href="{{ config.base_url }}{{ page_path }}" />
|
||||
<link rel="stylesheet" href="{{ prefix }}/style.css" />
|
||||
<link rel="icon" type="image/png" href="{{ prefix }}/logo.png" />
|
||||
</head>
|
||||
@@ -39,7 +39,7 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if config.nested_nav and item.children %}
|
||||
{% if config.nav.nested and item.children %}
|
||||
<div class="nav-children{% if is_current_section %} expanded{% endif %}">
|
||||
{% for child in item.children %}
|
||||
<a href="{{ prefix }}{{ child.path }}" {% if page_path==child.path %}class="active" {% endif %}>{{ child.label
|
||||
|
||||
9
docs/templates/homepage.html
vendored
9
docs/templates/homepage.html
vendored
@@ -1,9 +0,0 @@
|
||||
{% extends "base.html" %} {% block content %}
|
||||
<article class="homepage">
|
||||
<h1>{{ page.title }}</h1>
|
||||
{% if page.description %}
|
||||
<p class="lead">{{ page.description }}</p>
|
||||
{% endif %}
|
||||
<section class="content">{{ content | safe }}</section>
|
||||
</article>
|
||||
{% endblock content %}
|
||||
18
docs/templates/section/features.html
vendored
18
docs/templates/section/features.html
vendored
@@ -1,18 +0,0 @@
|
||||
{% extends "base.html" %} {% block content %}
|
||||
<article class="section-index">
|
||||
<h1>{{ section.title }}</h1>
|
||||
{% if section.description %}
|
||||
<p class="lead">{{ section.description }}</p>
|
||||
{% endif %}
|
||||
<nav class="section-nav">
|
||||
{% for item in items %}
|
||||
<a href="{{ prefix }}{{ item.path }}" class="section-link">
|
||||
<strong>{{ item.frontmatter.title }}</strong>
|
||||
{% if item.frontmatter.description %}
|
||||
<span>{{ item.frontmatter.description }}</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</article>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user