

以下是設定 Jekyll 首頁內容的步驟:
-
修改
_config.yml: 確保您的_config.yml中有以下設置:paginate: 5 paginate_path: "/page:num/" -
創建首頁模板: 在
_layouts目錄中創建一個home.html文件,並添加以下內容:--- layout: default --- <div class="home"> <h1 class="page-heading">{{ page.title | escape }}</h1> <ul class="post-list"> {% for post in paginator.posts %} <li> <span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span> <h2> <a class="post-link" href="{{ post.url | relative_url }}">{{ post.title | escape }}</a> </h2> </li> {% endfor %} </ul> <div class="pagination"> {% if paginator.previous_page %} <a class="pagination-item older" href="{{ paginator.previous_page_path | relative_url }}">← Older</a> {% endif %} {% if paginator.next_page %} <a class="pagination-item newer" href="{{ paginator.next_page_path | relative_url }}">Newer →</a> {% endif %} </div> </div> -
更新首頁文件: 確保您的
index.md文件中有以下內容:--- layout: home title: "首頁" permalink: / ---
完成以上步驟後,您的 Jekyll 首頁就會顯示最新的文章列表!