简体   繁体   English

将分类法​​模板添加到Blogdown默认主题

[英]Add template for taxonomies to Blogdown default theme

I seek to add tags and categories to the default blogdown theme (hugo-lithium theme). 我试图将标签和类别添加到默认的Blogdown主题(hugo-lithium主题)。

As a first step, config.toml is configured to include Categories and Tags links in the theme's main menu: 第一步,将config.toml配置为在主题的主菜单中包括Categories和Tags链接:

[[menu.main]]
    name = "Categories"
    url = "/categories/"
    weight = 2
[[menu.main]]
    name = "Tags"
    url = "/tags/"
    weight = 3

Clicking the Categories link displays: 单击类别链接显示:

Index of ./categories/ 
Name    Size    Date Modified 
./              2017-09-15 09:55:53 
../             2017-09-16 22:03:12 
r/              2017-09-15 09:55:53 
index.xml  695 B    2017-09-17 14:25:01 

Clicking the Tags links displays: 单击标签链接显示:

Index of ./tags/
Name    Size    Date Modified
./              2017-09-15 15:31:46
../             2017-09-16 22:03:12
aws/            2017-09-15 15:31:46
openemr/        2017-09-15 15:31:46
plot/           2017-09-15 09:55:53
r-markdown/     2017-09-15 09:55:53
regression/     2017-09-15 09:55:53
index.xml  1,199 B  2017-09-17 14:36:01

A better user experience is sought for manipulating the bog via Categories and Tags. 为了通过类别和标签操纵沼泽,寻求更好的用户体验。 I know it exists as I've seen it in other themes. 我知道它的存在,正如我在其他主题中所见。

I understand the problem to be that the template for taxonomies (terms.html) is not in the theme, so the index pages will not be generated (eg, tags/index.html). 我知道问题在于分类法模板(terms.html)不在主题中,因此不会生成索引页(例如,tags / index.html)。

How would one go about adding the template for taxonomies (terms.html) to the theme for a reasonable user for subsetting blog posts listings by categories and tag? 对于一个合理的用户,该如何将分类法模板(terms.html)添加到主题中,以便按类别和标签来细分博客文章列表?

For the record, this question has been cross-posted on Github . 作为记录,这个问题已经交叉发布在Github上

The hugo-lithium-theme does not have the template for taxonomies ( terms.html ), so the index pages will not be generated (eg, tags/index.html ). hugo-lithium-theme没有分类法的模板( terms.html ),因此不会生成索引页面(例如, tags/index.html )。 If you want to add it, I recommend you to spend some time on learning more about Hugo themes and templates in the blogdown book: https://bookdown.org/yihui/blogdown/templates.html , and add the template terms.html to the _default/ folder. 如果您想添加它,我建议您花一些时间在Blogdown书中了解更多有关Hugo主题和模板的信息https : //bookdown.org/yihui/blogdown/templates.html ,并添加模板terms.html_default/文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM