hugo-fixit / FixIt

🔧 A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
https://fixit.lruihao.cn
MIT License
727 stars 99 forks source link

[FEATURE] Why home page only render pages that type is posts #179

Closed boh5 closed 2 years ago

boh5 commented 2 years ago

Describe the feature you want 描述你的功能需求

A website may have many type pages, such as blogs, notes, etc... But now in layouts/index.html limit the page type:

      {{- $pages := where .Site.RegularPages "Type" "posts" -}}

So if I have a folder /content/notes to store my note, it will not show in home page, only if I manully set front matter type: posts. I don't think that is a good design, how do you think about that?

Useful reference 有价值的参考

I think there are 2 better design:

  1. Show all pages not only posts by change above code to:
    {{- $pages :=  .Site.RegularPages -}}
  2. Give a config to set what types or sections will show in home page, e.g.
    {{- $pages := where .Site.RegularPages "Type" "in" site.Params.mainSections -}}
Lruihao commented 2 years ago

@dilless Thanks for your suggestions at first!

Usually, as a blog-type site, the home page will display the content of the post instead of the page, and the same is true for hexo, wordpress, etc. FixIt's predecessor, LoveIt, did the same design, and I think it's reasonable, so I'm not going to change it.


However, if you just want to keep your blog post links in their original format, like /notes/xxx/, maybe you could simply modify the permalinks in the config file:

# Permalinks config (https://gohugo.io/content-management/urls/#permalinks)
[Permalinks]
  posts = "notes/:filename"
  # or posts store in /notes
  notes = "posts/:filename"

Of course, if you have to modify it, you could create a file with the same path on your blog to override the design of theme.

boh5 commented 2 years ago

@Lruihao Thanks for your comment. I will solve this problem with your suggestion.