Set content index navigation

This commit is contained in:
Helen Chong 2024-04-18 02:08:32 +08:00
parent 6dd7a0da82
commit b475c5767f
8 changed files with 33 additions and 23 deletions

View File

@ -1,17 +0,0 @@
<aside class="right-sidebar">
<nav class="blog__nav">
<h2 class="blog__nav--title">Navigation</h2>
<ul class="blog__nav--links">
{% for page in collections["blog pages"] %}
<li><a href="{{ page.url }}">{{ page.data.blogNav or page.data.title }}</a></li>
{% endfor %}
</ul>
</nav>
</aside>
<style>
.blog__nav {
position: sticky;
top: 4rem;
}
</style>

View File

@ -31,7 +31,7 @@ metadata:
{{ content | safe }}
</article>
{% if tags and tags.includes("posts") %}
{% include "blog/blognav.njk" %}
{% if tags and tags.includes("articles") or tags and tags.includes("posts") %}
{% include "main/content-nav.njk" %}
{% endif %}
</div>

View File

@ -0,0 +1,25 @@
<aside class="right-sidebar">
<nav class="content__nav">
<h2 class="content__nav--title">Content Index</h2>
<ul class="content__nav--links">
{% for archive in collections.archive %}
<li><a href="{{ archive.url }}">{{ archive.data.title }}</a></li>
{% endfor %}
<li><a href="/articles/">Articles</a></li>
{% for page in collections["blog pages"] %}
<li><a href="{{ page.url }}">{{ page.data.navTitle or page.data.title }}</a></li>
{% endfor %}
</ul>
</nav>
</aside>
<style>
.content__nav {
position: sticky;
top: 4rem;
}
.content__nav--title {
font-size: 1.7rem;
}
</style>

View File

@ -18,7 +18,7 @@ layout: main/base
{{ content | safe }}
</div>
{% if tags and tags.includes("blog pages") %}
{% include "blog/blognav.njk" %}
{% if title === "Articles" or tags and tags.includes("blog pages") %}
{% include "main/content-nav.njk" %}
{% endif %}
</div>

View File

@ -7,6 +7,8 @@ pagination:
title: Blog Archive
layout: main/content
tags: blog pages
eleventyComputed:
desc: Archive of blog posts on {{ sitemeta.siteName | safe }}
---
<ul class="blog__postlist">

View File

@ -1,5 +1,5 @@
{
"layout": "blog/blogpost",
"layout": "main/blogpost",
"tags": ["posts", "contents", "feed items"],
"eleventyComputed": {
"title": "{{ articleTitle }} | Blog"

View File

@ -5,7 +5,7 @@ desc: Blog hosted on Leilukin's personal website.
tags: blog pages
date: 2022-01-04
pageTitle: Welcome to Leilukin's Hub Blog!
blogNav: Blog Home
navTitle: Blog Home
pagination:
data: collections.posts
size: 5