If the section contains a custom index.md
into the section, Hugo ignores it and replaces to the standard list. Itβs specially conceived? Or exist a possibility to use a custom index.md
in the section?
Version 0.17 correctly processed index.md
in the section.
Support for the customs index.md for ever disabled in the Hugo?
No, it is better than ever β you donβt have to use to common index.md hack. Use _index.md instead.
I am confused by how it behaves now.
Consider the now-broken theme βphugoβ. Itβs albums used to work perfectly fine with index.md
, like here.
With Hugo 0.18 that index.md
renders with a list layout - but not ignored, see the effect here. If I rename it to _index.md
it seemds to be ignored altogether - neither list, nor single.
If the albums moved into a subfolder , so they are not considered sections they work fine. with index.md
being rendered as a single.
What do I miss? Or at least, what is a migration path to accommodate new behaviour? Adding another directory layer is highly undesirable.
_index.md
not work for sections, itβs work for taxonomies only.
@bep, so if _index.md
does not work in sections, what do you mean as
So far I do not see how that breaking change can be reasonably accommodated in phugo
. May be some hints can be placed in an index.md
front matter to steer rendering? What else may be done?
I do not understand why do we need an _index.md
in the sections if there already exist the index.md
with front matter and content.
I do not either, except for @bep have seemed to suggest to use it. I may have missed a context of the suggestion though. The point is that index.md
no longer works with hugo 0.18 the way it did with hugo 0.17 in phugo
theme and I am trying to undestand what can be done to fix it.
_index.md works for sections, home page, taxonomy terms, taxonomy lists. That should cover all the current use cases.
Iβm on Christmas holiday now, so that is the answer you get from me.
Read the documentation. If that is not good enough, please file an issue on GitHub so we can fix it, so we donβt have to answer the same questions again and again. Then you can keep on using Hugo 0.17 until you understand how to upgrade.
Believe me when I say this: Hugo 0.18 is a big, big improvement β and this means that you can remove your index.md hacks, which, to be honest, you where kind of lucky that worked for sections in 0.17 (the page were generated after the section so index.html overwrote index.html).
Good.
Sorry for my Ebenezer Scrooge tone in my replies earlier β I have spent many hours thinking and implementing this, and I sometimes forget that this may not be obvious to those who have not.
Merry Xmas to all Hugoers!
Sorry to come back on this, but I think that my problem is linked with it:
@bep wrote in Hugo 0.18 Released: Everything Now a Page, and Twice as Fast!:
index.md or foo.md is content and metadata for the single pages, _index.md of content and metadata for the βnodeβ pages β aka the list pages (if you include the home page in that definition).
I find this working: create a /section/index.md
in a section and it renders to /section/index.html
in that same section in the public folder.
But when I use this
<ul>
{{ $act_section := .Section}}
{{ range where .Site.Pages "Section" $act_section }}
<li><a href="{{ .RelPermalink }}">{{- .LinkTitle -}}</a></li>
{{ end }}
</ul>
to create a section navigation it uses linktitle from the frontmatter of /section/index.md
but the created link instead points to /section.html
which gives a simple list but not the content of /section/index.md
.
If I just rename /section/index.md
to something else like /section/intro.md
everything works fine.
(But then, off course, I have to tweak the server config to use intro.html
as default page also which I personally do not prefer).
v0.18.1 BuildDate: 2016-12-30T11:05:34+01:00
uglyURLs = true
relativeURLs = true
canonifyURLs = false
Iβm not totally sure what youβre trying to do, but did you check out the .GetPage function? Also remember the section page is _index.md and not index.md. Iβd write some sample code but am on my phone. Also there is .Pages and .RegularPagesβ¦
From the above [quote="@bep"]
index.md or foo.md is content and metadata for the single pages,
[/quote] I expected that index.md
would render as index.html
which indeed it does. I like to have an index-file in each content subdirectory as every webserver I know will deliver this when a user uses an address like http://domain.tld/section/
.
All works fine so far.
Iβll give you the structure:
.
βββ config.toml
βββ archetypes
βββ content
| βββ _index.md
| βββ motorhome
| | βββ index.md
| | βββ engine.md
| | βββ solar.md
| | βββ chassis.md
| βββ dogs
| βββ blog
| βββ contact
βββ static
βββ data
βββ layouts
βββ themes
and this renders to
.
βββ public
βββ index.html
βββ motorhome.html
βββ motorhome
| βββ index.html
| βββ engine.html
| βββ solar.html
| βββ chassis.html
βββ dogs.html
βββ dogs
βββ blog.html
βββ blog
βββ contact.html
βββ contact
which is ok so far - and as expected following @bep 's definition.
Now I use above code to produce a sidenav within the motorhome section. It ends up like this:
<li><a href="../motorhome.html">Index</a></li>
<li><a href="../motorhome/engine.html">Engine</a></li>
<li><a href="../motorhome/solar.html">Solar</a></li>
<li><a href="../motorhome/chassis.html">Chassis</a></li>
which obviously is wrong since the first line should be like
<li><a href="../motorhome/index.html">Index</a></li>
So at least for creating the menue index.md is NOT treated as content and metadata for a single page.
What above code?