dillonzq / LoveIt

❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
https://hugoloveit.com
MIT License
3.34k stars 1.07k forks source link

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

Open mfioretti opened 10 months ago

mfioretti commented 10 months ago

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)

liaobinbin commented 10 months ago

https://github.com/dillonzq/LoveIt/blob/e9e89a4613baee823596822b7d246f5931263491/layouts/taxonomy/terms.html#L14-L17

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

https://github.com/dillonzq/LoveIt/blob/e9e89a4613baee823596822b7d246f5931263491/layouts/_default/section.html#L8-L15

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/

mfioretti commented 10 months ago

Thanks @liaobinbin , that was very useful!