PaperMod文章添加过时提醒

技术性文章没有内容提醒怎么行的,技术快速迭代,今天可以的方法明天可能就不行了 网上搜了一圈,对应主题的没找到现成的,只能魔改了 只针对PaperMod主题的,其他自己魔改,大同小异 1、添加自定义模版 Hugo根目录创建layouts\partials\outdated_warning.html 复制下面代码到 outdated_warning.html内 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 {{- if or .Params.enableOutdatedInfoWarning (and .Site.Params.outdatedInfoWarning.enable (ne .Params.enableOutdatedInfoWarning false)) }} {{- $daysAgo := div (sub now.Unix $.Page.Params.Lastmod.Unix) 86400 }} {{- $hintThreshold := .Site.Params.outdatedInfoWarning.hint | default 30 }} {{- $warnThreshold := .Site.Params.outdatedInfoWarning.warn | default 180 }} {{- $updateTime := $.Page.Params.Lastmod }} {{- if gt $daysAgo $hintThreshold }} <div class="post-outdated"> {{- if gt $daysAgo $warnThreshold }} <div class="warn"> {{- else }} <div class="hint"> {{- end }} <p>{{ i18n "outdatedInfoWarningBefore" .}} <span class="timeago" datetime="{{ dateFormat "2006-01-02T15:04:05" $updateTime }}" title="{{ dateFormat "January 2, 2006" $updateTime }}"> {{- dateFormat "January 2, 2006" $updateTime -}} </span>{{ i18n "outdatedInfoWarningAfter" .}} </p> </div> </div> {{- end -}} {{- end -}} 2、添加到文章模版内 Hugo根目录创建layouts/_default/single.html 在目录下方或者文章上方添加 1 2 3 4 5 6 7 8 {{ partial "outdated_warning.html" . }} {{- if ....

创建: 2023-03-26 | 更新: 2024-07-16 | 字数: 300字 | 时长: 2分钟 | 作者:张三

低成本搭建高质量播客发布服务

引言:最近用了iPhone手机,听Apple music的时候,有些喜欢的歌曲并没有,想下载到本地但由于iOS的生态封闭,操作太麻烦; 在寻找解决方案时发现用自建播客来实现下载音乐方案可行,于是就有了下面的教程 What 播客(podcast)创作者将音频或视频上传至RSS或在线播客平台,听众或观众则通过软件获取节目更新。 How 制作过程不说了,来谈谈发布过程,很简单,一个支持RSS的网站发布音频信息供用户拉取,一个音频托管平台存放音频 网站直接Hugo搭建,用zen主题支持podcast,放在GitHub page上,域名可以在freedom上注册,用cloudflare DNS解析和加速 hugo 搭建播客 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #新建网站 hugo new site podcast #安装 zen主题 git clone https://github.com/frjo/hugo-theme-zen.git themes/zen #在content内新建podcast文件夹,此页面内新增音频 cd content mkdir podcast #podcast的一些设置 #设置的图片,需要现在根目录新建 assets/images 目录,取相对路径即可 #podcast 音频下面显示链接,如何取消 vim layouts/partials/podcast.html #注释掉下面行 <figcaption><a href="{{ $src }}">{{ .Title }}</a></figcaption> podcast 配置 1 2 3 4 #文章顶部新增参数 podcast: mp3: duration: 音频托管平台自建minin服务存储音频 minio服务很强大,感兴趣可以了解一下 docker 部署 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 version: '3.3' services: minio: image: quay.io/minio/minio container_name: minio1 ports: - 9090:9090 #控制台端口 - 9000:9000 #API端口 volumes: - './data:/data' - './config:/root/.minio' environment: MINIO_ROOT_USER: admin #管理用户名 MINIO_ROOT_PASSWORD: admin #管理密码 command: server /data --console-address ':9090' restart: always 部署成功,ip:9090访问登录 控制台操作 1、创建存储桶 create bucket 2、点击manage,Access Rules add rule prefix:*.* access:readonly 3、上传音频 4、分享文件,链接地址 复制出来,前面ip换成外部ip即可 把地址贴在上面podcast 参数 mp3 的地方 enjoy 这样算下来,除了用了一台服务器外,其他全部费用为零,总费用百元不到 部署全部完成,点击RSS链接放到订阅的地方,尽情享用吧!🎉 参考: Zen | Hugo Themes...

创建: 2022-07-12 | 更新: 2024-07-16 | 字数: 186字 | 时长: 1分钟 | 作者:张三

Hugo 自动更新文章修改时间

config配置文件里加上如下参数: 1 2 3 4 5 6 frontmatter: lastmod: - lastmod - :git - :fileModTime - :default 依次取的顺序为: lastmod :最后提交时间 :git: 根据git提交版本时间 :fileModTime:文件修改时间 Configure Hugo | Hugo 写的都有,but是英文的🙃

创建: 2022-01-22 | 更新: 2024-07-16 | 字数: 28字 | 时长: 1分钟 | 作者:张三