Skip to content

yoyoshenTW/hugo-shortcode-listpost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

透過 Hugo Markdown 中,依照標題的字母排序所有 post 內的文章

實際效果可參考我的網站作品 Jazz LeadSheets

說明

此 Shortcode 為使用在 Hugo 之中,他能夠抓取你在 content/post/ 下的所有文件,並依照 "Title" 的字母順序排列,包含以下功能:

  1. 可以抓取所有 content/post/ 下的文件的標題。
  2. 建立標題開頭的字母分類。
  3. 點擊文章標題後可以跳轉到該文章的網址。

如何使用

寫入 hugo shortcode 檔案

請下載這份檔案 list-post 並將他放在你 Hugo 網站的根目錄的 layouts/shortcodes 底下

在 Hugo 中透過 Shortcode 功能使用

接著在你的 markdown 文件中(例如 index.md) 引用此 shortcode {{< list-post >}},即可實現列出所有文章標題與連結功能。

Example

---
title: All post by Alphabet
---
{{< list-post >}}

List All Posts by Alphabetical Title in Hugo Markdown

You can see a working example on my project site: Jazz LeadSheets

Description

This shortcode is designed for use with Hugo. It retrieves all documents under the content/post/ directory and sorts them alphabetically by "Title". It includes the following features:

  1. Retrieves the titles of all documents under content/post/.
  2. Groups titles by their starting letter.
  3. Clicking on a post title navigates to its corresponding URL.

How to Use

Add the Hugo Shortcode File

Download this file: list-post and place it in your Hugo site's root directory under layouts/shortcodes.

Use the Shortcode in Hugo Markdown

Then, in your Markdown file (e.g., index.md), use the shortcode {{< list-post >}} to list all post titles and links.

Example

---
title: All post by Alphabet
---
{{< list-post >}}

About

list your all post for hugo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages