dillonzq / LoveIt

❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题

Home Page:https://hugoloveit.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] _index.md worked fine with other theme/hugo version, not now

mfioretti opened this issue · comments

Describe the bug

I have an _index.md file in a subfolder that worked just fine with an older hugo version, and the the academic theme. It dows not work anymore with the LoveIt theme and newer Hugo, and I cannot figure out whether the problem it's the theme or the version, so thanks a lot for your help:

Expected behavior

I have a file _index.md in a folder called writings:

/writings/_index.md

That file (see screenshot) contains a paragraph of constant, custom text ("My most important writings include..."), to display before listing all the other posts in the writings subfolder. This is exactly what happens with the old theme (see screenshots). But now, using LoveIt, it does not happen anymore. I have checked documentation like this, but honestly cannot recognize where the problem is, or why something like this, that works perfectly with one theme does not work with the other.

Thanks in advance for any help!

Screenshots

Before

This is how the page /writings/index.html looks like when using v0.56.1-0AD218AF linux/amd64 and the academic theme (i.e. it does show "My most important writings etc..." before listing the single posts in that subfolder):

Selection_002

Now

And this is same _index.md as rendered with LoveIt and current hugo, see version below. As you can see, there is no more the initial text, just the list of writings, sorted by year:

Selection_001

Build Environment

hugo v0.92.2+extended linux/amd64 BuildDate=2023-01-31T11:11:57Z VendorInfo=ubuntu:0.92.2-1ubuntu0.1

Browser: Firefox (but it's irrelevant, the text isn't in the HTML file at all)

</h2>
{{- /* Categories Page */ -}}
{{- if eq $taxonomies "categories" -}}

You should add {{ .Content }} on line 15. This file is for the categories page.

<h2 class="single-title animate__animated animate__pulse animate__faster">
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" -}}
</h2>
{{- /* Paginate */ -}}
{{- if .Pages -}}
{{- $pages := .Pages.GroupByDate "2006" -}}
{{- with .Site.Params.section.paginate | default .Site.Params.paginate -}}

And this file is for the post page. You can code it up to line 11.

_index.md file will be work.

I'm just giving you some examples. You should find all the locations you want and modify them.

Reference: https://bwaycer.github.io/hugo_tutorial.hugo/content/using-index-md/

Thanks @liaobinbin , that was very useful!