How I automatically create my blogroll

栏目: IT技术 · 发布时间: 6年前

内容简介:I just updatedmy blogrolland thought that it might be a great idea to share my workflow to do exactly that.I use Miniflux a lot. Using Miniflux, I read all the blogs and get all the news,get updates from all the YouTubersand even subscribe to some Mastodon

I just updatedmy blogrolland thought that it might be a great idea to share my workflow to do exactly that.

I use Miniflux a lot. Using Miniflux, I read all the blogs and get all the news,get updates from all the YouTubersand even subscribe to some Mastodon accounts ( fediverse microblogs). I use multiple categories to sort the feeds. One of those categories is “Blogs” with all the blogs, which I also list on my blogroll.

The list of blogs I follow is always evolving. Sometimes I find new sites to follow, so I add their feeds to the list of subscriptions and put them into the “Blogs” category. Sometimes I also unsubscribe from feeds when they are inactive or if I’m not that much interested into them anymore (it can have multiple reasons).

To keep my blogroll up-to-date and to avoid having to manually compare and adjust the list with the list from Miniflux when updating it, it is automatically created using a Hugo shortcode .

First, I create an OPML export from my Miniflux subscriptions. This can be easily done by going to “Subscriptions” and then clicking on “Export”. I open the download with a text editor and remove all the categories that aren’t “Blogs”. I copy the remaining OPML code and convert it to JSON using this tool . This JSON I store in a file named opml.json in the data folder of my Hugo -based blog.

In the layouts/shortcodes folder, I created a shortcode template named blogroll.html with the following content:

<ul>
    {{ $opmlJson := index .Site.Data.opml "opml" "body" "outline" "outline" }}
    {{ range sort $opmlJson "_title" "asc" }}
    <li><a href="{{ ._htmlUrl }}" target="_blank">{{ ._title }}</a></li>
    {{ end }}
</ul>

This shortcode is then used by adding {{< blogroll >}} in the blogroll content file.

In the end, all I have to do to update my blogroll is update the opml.json file and update the lastmod frontmatter parameter in the blogroll content file.

Check out my blogroll!


以上所述就是小编给大家介绍的《How I automatically create my blogroll》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

精益数据分析

精益数据分析

[加] 阿利斯泰尔·克罗尔、[加] 本杰明·尤科维奇 / 韩知白、王鹤达 / 人民邮电出版社 / 2014-12 / 79.00元

本书展示了如何验证自己的设想、找到真正的客户、打造能赚钱的产品,以及提升企业知名度。30多个案例分析,全球100多位知名企业家的真知灼见,为你呈现来之不易、经过实践检验的创业心得和宝贵经验,值得每位创业家和企业家一读。 深入理解精益创业、数据分析基础,和数据驱动的思维模式 如何将六个典型的商业模式应用到各种规模的新企业 找到你的第一关键指标 确定底线,找到出发点 在大......一起来看看 《精益数据分析》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

随机密码生成器
随机密码生成器

多种字符组合密码