Improve nav links logic (BREAKING CHANGE)

This commit is contained in:
daudix
2024-04-01 07:08:09 +03:00
parent 63c5d14b1d
commit 6630785ecb
4 changed files with 16 additions and 11 deletions

View File

@ -52,8 +52,8 @@ source_url = "https://codeberg.org/daudix/duckquill"
show_feed = true
# Links used in the nav
links = [
{url = "$BASE_URL/blog", name = "Blog"},
{url = "$BASE_URL/demo", name = "Demo"},
{url = "@/blog/_index.md", name = "Blog"},
{url = "@/demo/index.md", name = "Demo"},
{url = "https://codeberg.org/daudix/duckquill", name = "Repo"},
]

View File

@ -4,7 +4,7 @@
{% endif %}
{% if config.extra.footer.show_source %}
<p><a href="{{ config.extra.source_url }}">Website source</a></p>
<p><a href="{{ config.extra.source_url | safe }}">Website source</a></p>
{% endif %}
{% if config.extra.footer.show_powered_by %}

View File

@ -5,7 +5,7 @@
<meta name="description" content="{{ config.description }}" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="{{ config.extra.primary_color }}" />
<link rel="canonical" href="{{ current_url | default(value='/') }}" />
<link rel="canonical" href="{{ current_url | default(value='/') | safe }}" />
<title>
{%- if page.title -%}
@ -56,7 +56,7 @@
<!-- Open Graph -->
<meta property="og:site_name" content="{{ config.title }}" />
<meta property="og:title" content="{%- if page.title -%}{{- page.title }} - {{ config.title -}}{%- elif section.title -%}{{- section.title }} - {{ config.title -}}{%- else -%}{{- config.title -}}{%- endif -%}" />
<meta property="og:url" content="{{ current_url | default(value='/') }}" />
<meta property="og:url" content="{{ current_url | default(value='/') | safe }}" />
<meta property="og:description" content="{{ page.description | default(value=config.description) }}" />
<meta property="og:image" content="{{ get_url(path='card.png') }}" />
<meta property="twitter:card" content="summary_large_image" />

View File

@ -3,17 +3,22 @@
<a href="#main" id="main-content" tabindex="0">Skip to main content</a>
<ul>
<li id="home">
<a href="{{ get_url(path='/') }}">{{ config.title }}</a>
<a href="{{ get_url(path='/') | safe }}">{{ config.title }}</a>
</li>
{% for link in config.extra.nav.links %}
{%- if link.url is matching('https?://') %}
<li>
<a href="{{ link.url | safe | replace(from='$BASE_URL', to=get_url(path='/')) | safe }}">{{ link.name
}}</a>
<a href="{{ link.url | safe }}">{{ link.name }}</a>
</li>
{%- else %}
<li>
<a href="{{ get_url(path=link.url | safe )}}">{{ link.name }}</a>
</li>
{%- endif %}
{% endfor %}
{% if config.extra.nav.show_feed %}
<li id="feed">
<a href="{{ get_url(path='/') }}/{{ config.feed_filename }}">
<a href="{{ get_url(path=config.feed_filename) | safe }}">
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M1.988 1.988V3c.008.547.453.984 1 .988.004-.004.008-.004.012-.004v.028A8.977 8.977 0 0 1 11.988 13a.991.991 0 0 0 1 .984h1V13h-.004c0-.004 0-.004.004-.008C13.984 7.02 9.184 2.148 3.242 2.02A1.004 1.004 0 0 0 3 1.988v-.004zm0 4V7c.008.547.453.984 1 .988.004-.004.008-.004.012-.004V8a4.985 4.985 0 0 1 4.996 4.844 1.002 1.002 0 0 0 .988 1.145c.008-.005.012-.005.016-.005v.004h.984V13H10c0-3.793-3.047-6.898-6.82-6.992 0-.004-.004-.004-.004-.004A.892.892 0 0 0 3 5.988v-.004zm2 4a1.999 1.999 0 1 0-.002 3.998 1.999 1.999 0 0 0 .002-3.998m0 0" /></svg>
<span>Feed</span>
</a>