Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hard coded section name #67

Merged
merged 3 commits into from
May 31, 2018

Conversation

keithmork
Copy link
Contributor

@keithmork keithmork commented May 28, 2018

Resolve issue: #65

Fix empty article list problem when clicking into a tag/category that is not defined in the section named "post".

修复了由"post"以外的section里的文章定义的标签/分类,点进去无法展示文章列表的问题。

@keithmork
Copy link
Contributor Author

把index.html写死的地方也去掉了,我测过直接放在 content 下的 about.md 之类的页面不会被收录进首页。

效果见这里:http://keithmo.me/

@olOwOlo
Copy link
Owner

olOwOlo commented May 30, 2018

index.html 不需要修改,其他页面没有显示是因为没有提供 summary.html 渲染了一个空内容,实际上是占了分页的空间了。如果你要在首页显示其他 section 的内容,把那个 section 添加到 where 的参数中

where .Data.Pages "Type" "in" "post, other"

@keithmork
Copy link
Contributor Author

keithmork commented May 31, 2018

嗯,我是把single和summary都复制到其他section下的,所以刚好就是想要的效果了。
让用户自己加section也行,但这样每加一个section除了复制文件还要改 index.html,门槛会增加那么一点点,起码要知道这主题源码里这地方写死了。

不限制的话只需要复制整个post文件夹改个名就行了。而那些像about、links之类通常不希望收录的页面也照样不会显示,对于只用默认section的用户来说什么都没改变,似乎不会破坏什么。你觉得呢?:)

想了下这做法还是不好,如果把index改了,用户希望另外的section所有文章在主页隐藏就不太方便。我还原一下。

关于门槛的问题,不如我在 exampleSite 下面加个例子?
比如新建section catdog,cat 里的文章展示在首页,dog里的不展示,加个 layout 文件夹放修改过的index,再写篇叫做 multiple sections 的文章教人怎么改index和archetype?

@olOwOlo
Copy link
Owner

olOwOlo commented May 31, 2018

不是的,实际上是占了分页的空间了,假如每页只显示 1 篇文章,你有 1 篇 post,另1 篇是 about,就会生成 2 页,但是由于 about 没有 summary 你会看到一页空内容

@olOwOlo olOwOlo merged commit 6766e09 into olOwOlo:master May 31, 2018
@Azureki
Copy link

Azureki commented Aug 18, 2019

终于找到了这个帖子……仔细看了回复才知道什么意思。
总结一下:

  1. 修改 `layouts/index.html',添加section name
  2. 复制一个 `summary.html' 。
    以上两步都做了,首页才有这个section的文章。

daymade pushed a commit to daymade/hugo-theme-even that referenced this pull request Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants