How to get subpages/multi-level pages working in hugo?

2,877 views
Skip to first unread message

rahul286

unread,
Sep 12, 2014, 9:42:25 AM9/12/14
to hugo-d...@googlegroups.com
Hello All,

I have posted this in details - https://github.com/spf13/hugo/issues/465

Till it gets added to hugo, is there any workaround or hack that can be used to get atleast index pages working for subfolder?

What I mean is, I created index.markdown in subfolder expecting, it will get converted to index.html but index.markdown in subfolder was not processed.

Alex Dunn

unread,
Sep 14, 2014, 5:49:05 PM9/14/14
to hugo-d...@googlegroups.com
I think you're trying to do the same thing I was, which apparently isn't possible yet: https://groups.google.com/d/msg/hugo-discuss/awyNO5sq14A/Dstzc7tZZ4IJ

Rahul Bansal

unread,
Sep 15, 2014, 3:14:57 AM9/15/14
to Alex Dunn, hugo-d...@googlegroups.com
Yep. That is exactly what is stopping me using hugo on documentation sites! :|

All our documentation sites have nested directories. At bare minimum index.html is needed for subdirectories. 

Did you manage to find any workaround to get things done for now?

--
Rahul Bansal | Founder & CEO 
rtCamp Solutions Pvt. Ltd. | https://rtcamp.com/

--
Hugo
 
A Fast and Flexible Static Site Generator built with love by spf13 and friends in Go
 
Download the latest at https://github.com/spf13/hugo/releases
---
You received this message because you are subscribed to a topic in the Google Groups "Hugo Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hugo-discuss/rEUQHcDyHOw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hugo-discuss...@googlegroups.com.
To post to this group, send email to hugo-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/hugo-discuss.
For more options, visit https://groups.google.com/d/optout.

Steve Francia

unread,
Sep 15, 2014, 9:46:52 AM9/15/14
to Rahul Bansal, Alex Dunn, hugo-d...@googlegroups.com
I've been giving this a lot of thought and will be addressing this shortly. I think it's just an extension of the existing section functionality.

What needs to happen is: 

Part 1:
Hugo needs to register each directory along with it's contents. 

Part 2:
Process each directory as a list. 

We need to expose three things to the template. 
1. The Tree (descending)
2. The children
3. All descendants

This will give maximum flexibility to the template so it can render content however it chooses.

Part 3:
We also need a mechanism to correlate a template with a specific directory. It would use the 
/layouts/_default/list.html as it's fall back, but it would be great to have a logical way to specify this more granularly.

First thought is to follow the pattern used by section.. which is really this, but only applies to the first level.

I'm thinking:
/layouts/section/SECTION/SUBSECTION/SUBSUBSECTION.html
/layouts/section/SECTION/SUBSECTION.html
/layouts/section/SECTION.html
/layouts/_default/section.html
/layouts/_default/list.html

By using this approach it permits the user to be very granular for the layout for a specific tree or directory without too much work. Each directory would be able to specific a specific layout for itself and it's descendants. Otherwise, the general section or list templates would be used. 

Does this all make sense? Satisfy your needs?
You received this message because you are subscribed to the Google Groups "Hugo Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hugo-discuss...@googlegroups.com.

Rahul Bansal

unread,
Sep 15, 2014, 10:15:57 AM9/15/14
to Steve Francia, Alex Dunn, hugo-d...@googlegroups.com
First, thanks for looking into it! :-)

Part 1: Perfect.

Part 2: Sounds perfect. 

I will just write down my understanding of this system. 
Looks like:

> 1. The Tree (descending)
Entire tree of pages. Something like global variable.

> 2. The children
Immediate children. Pages in "this" directory + sub-directories in "this" directory.

> 3. All descendants
All pages and sub-directories below this level.
I think this is more like index/pointer in global tree. So templates can have idea, current pointer location.

Sorry if I am wrong in my assumptions. But 3 "things" can cover all combination.

I think, we can generate "breadcrumb" as well from this. Please note breadcrumb is not very important at this moment.

Part 3: Perfect. 

Though following two can be removed or added later:

> /layouts/section/SECTION/SUBSECTION/SUBSUBSECTION.html
> /layouts/section/SECTION/SUBSECTION.html

Overall, this will cover everything we need. 

I hate to ask this, but as I have few projects stuck on this, may I know if there is any ETA.

It's perfectly fine if there is no ETA for this. 

Thanks again for looking into this. :-)

--
Rahul Bansal | Founder & CEO 
rtCamp Solutions Pvt. Ltd. | https://rtcamp.com/

Reply all
Reply to author
Forward
0 new messages