跳过正文
  1. Hugo博客相关/

hugo博客-blowfish主题添加时间轴

·342 字·1 分钟·
Hugo Blowfish Archives
古德
作者
古德
目录

添加时间轴,归档博客。

1. 创建时间轴相关文件
#

1.1 创建archives.html文件
#

  • 复制layouts/default目录下的single.html文件为archives.html,并用以下代码替代html中的{{ .Content }}
    • {{ range (where .Pages “Type” “blog”) }}:用于仅展示content目录下类型为blog的md文件
    {{ range (.Site.RegularPages.GroupByDate "2006") }}   
    <h3>{{ .Key }}</h3>  
    <ul class="archive-list">  
        {{ range (where .Pages "Type" "blog") }}
            <li>  
                {{ .PublishDate.Format "2006-01-02" }}  
                ->  
                <a href="{{ .RelPermalink }}">{{ .Title }}</a>  
            </li>  
        {{ end }}  
    </ul>  
    {{ end }} 

1.2 创建archives.md文件
#

  • 在content目录下创建archives.md文件
---
title: "时间轴"
layout: "archives"
date: 2017-07-17
description: "历史文章按照年归档."
type: "archives"

cascade:
  showDate: true
  showAuthor: true
  invertPagination: true
---

2. 添加配置
#

  • 在config/_default/menus.zh-cn.toml中添加如下配置
[[main]]
  name = "时间轴"
  pageRef = "archives"
  weight = 300

相关文章

hugo博客-blowfish主题添加giscus作为评论系统
·322 字·1 分钟
Hugo Blowfish Comments
hugo博客-blowfish主题添加音乐组件
·889 字·2 分钟
Hugo Blowfish Music
k8s(kubectl get cs)健康检查报错
·370 字·1 分钟
Kubernetes Unhealthy
windows笔记本wifi连接正常上不了网
·195 字·1 分钟
Os Windows Wifi
各类工具网址记录
·343 字·1 分钟
Net Https Tools
Windows通过KTConnect连接服务器K8S集群
·768 字·2 分钟
Kubernetes Ktconnect Windows Proxy