devcows / hugo-universal-theme

Universal theme for Hugo, it stands out with its clean design and elegant typography.
https://devcows.github.io/hugo-universal-theme
MIT License
803 stars 569 forks source link

_index.md content not showing #90

Open brianking opened 7 years ago

brianking commented 7 years ago

I create a section landing page with an _index.md file:

e.g. hugo new about/_index.md

There are 2 issues:

  1. Content in the file does not appear, i.e. the page is blank. It is the correct file because the page title appears correctly.
  2. The page has pagination. I would not need this on pages outside the blog.

Neither of these issues happens if the page is named something other than _index.md.

Karolinehc commented 7 years ago

Hello :) I have cloned and replaced the configuration tolm from examplesite into the folder of "new site" and folder themes to know like it looks on my browser but it just appears the icons and the header :(

C:\Hugo\Sites\tercero>hugo.exe server --theme=hugo-universal-theme --buildDrafts Started building sites ... ERROR 2017/06/24 06:37:28 Error while rendering "home": template: theme/index.html:18:11: executing "theme/index.html" at <partial "carousel.ht...>: error calling partial: template: theme/partials/carousel.html:3:10: executing "theme/partials/carousel.html" at <len .Site.Data.carou...>: error calling len: len of untyped nil Built site for language en: 0 draft content 0 future content 0 expired content 0 regular pages created 6 other pages created 0 non-page files copied 0 paginator pages created 0 tags created 0 categories created total in 34 ms

kwamenna commented 7 years ago

@Karolinehc if you already have not found a fix yet take a look.

Karolinehc commented 7 years ago

@MorseGates thanks a lot :)

xpegenaute commented 6 years ago

Hi all and thanks for your time/work.

I've been trying to use this theme but apparently this is still lacking support for the problem stated by @brianking . Is there any plan to fix it ?

Regards, Xavi

ryanfox1985 commented 6 years ago

Hi,

looking the documentation I found: https://gohugo.io/commands/hugo_new/#synopsis it says:

If archetypes are provided in your theme or site, they will be used.

We are using archetypes, so maybe is not compatible.

Regards.

xpegenaute commented 6 years ago

Hi,

apparently it is nor related. I moved the default.md from the archetypes dir outside of the hugo installation, emptied all the archetypes dirs and tried again. I did'nt work either.

Thanks & regards, Xavi

GeorgeWL commented 6 years ago

Think Hugo might be daft and search for the folder, regardless of whether it has contents?

Try deleting the entire container too and see if there's a different result? Rather than emptying.

nnfans commented 5 years ago

Had same problem like this on the Hugo Coder Theme. Rather than render as a page, it render as a list page.

jesselawson commented 5 years ago

You can add {{ .Content}} to the list template and it will render the contents of your _index.md file that sits in a folder where content is root.

ivanbportugal commented 5 years ago

I am getting some pretty weird behavior using the Academic theme (https://sourcethemes.com/academic/docs/): _index.md MIGHT show the content if I do {{ .Content}} but it also might not. Hugo seems to be picking and choosing what is a 'page' vs a 'regular page' and only 'regular pages' have any content in them. Here is one of the folders in the content folder:

>posts
>>post-1
>>>_index.md
>>post-2
>>>_index.md
>>post-3
>>>_index.md
>>_index.md

So the top level _index.md shows up with post-1, 2, and 3 correctly. And when I click on each of them the title shows up for those pages. Except only post-3 shows the content. The other two show empty... Why? Not really sure.

One problem is that Hugo is rendering layouts/posts/list.html instead of layouts/posts/single.html in the single view!

Another problem is that Hugo thinks that an arbitrary post is a regular page whereas all of the other ones are not (so {{ .Content}} is empty).

Puzzling...

ivanbportugal commented 5 years ago

In case you guys might be wondering: Hugo HIDES future content. That's what the problem was with mine. So, if you date your post after today, you need to build it with the -F argument:

hugo server -F

:: bangs head on keyboard ::

GeorgeWL commented 5 years ago

so resolved?

Lokdei commented 2 years ago

Content in the file does not appear, i.e. the page is blank. It is the correct file because the page title appears correctly.

As @jesselawson indicated, the way to do this is by adding the following

<div id="post-content">
{{ .Content }}
</div>

inside of the file titled: list.html

You can find the file here: your-site > themes > hugo-universal-theme > layouts > _default > list.html

You probably wish to add it below the following line: https://github.com/devcows/hugo-universal-theme/blob/00e1f20103c31bc2908f4c3e20b98093e6012241/layouts/_default/list.html#L23

If you have content, it will now show up. If you have no content in the _index.md file, your page will look as expected.

quintinm-dev commented 2 years ago

I ran into a similar issue with another theme. _index.md would sometimes get the list.html layout and other-times the terms.html layout (which was empty for me). I fixed it by manually specifying layout: list in _index.md's front matter.

I'd have to dig deeper to figure out why the lookup-order isn't working deterministically. But since I only have a few _index files I'm not too worried about manually overriding.