Skip to content

Commit

Permalink
feat(blog): add blog index page and exclude it from processing
Browse files Browse the repository at this point in the history
The changes include:
- Add new blog/index.md to display a list of blog posts
- Modify .make.sh to exclude index.md from blog processing

This change improves blog organization by:
- Creating a dedicated landing page for all blog posts
- Preventing index.md from being processed as a regular blog post

Signed-off-by: Chun-Yu Lee (Mat) <[email protected]>
  • Loading branch information
matlinuxer2 committed Oct 26, 2024
1 parent 585e9e2 commit 6bd7f32
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function process_blogs() {
tmpd=$(mktemp -d)
(
cd $ROOT_DIR || exit
find blog/ -maxdepth 1 -type f -name "*.md" | sort | while read -r line; do
find blog/ -maxdepth 1 -type f -name "*.md" | grep -v -e "index.md" | sort | while read -r line; do
echo "Processing $line ..."
fpath="$line"
title=$(cat "$fpath" | remove_frontmatter | head -1 | grep -e "^#\s\+" | sed -e "s/^#\s*//g")
Expand Down
14 changes: 14 additions & 0 deletions blog/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
layout: default
title: Blog
---
# Blog

<ul>
{% for post in site.categories.blog %}
<li>
<span>{{ post.date | date: "%Y-%m-%d" }}</span>
<a href="{{ post.url }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>

0 comments on commit 6bd7f32

Please sign in to comment.