hugo-theme-docdock
hugo-theme-docdock copied to clipboard
Augmenting index pages
I noticed that docbook will automatically generate a summary of sub-pages if the content of _index.md is left blank. (see https://drugsinmind.net/23.treatment_services/ for instance)
This is a really nice feature which would make sense to document a little better. I was wondering if it's also possible to retain this behaviour while inserting an introductory paragraph to the _index.md page?
You can put parameters in the children shortcode so that it gives a description of every child page. Is this the functionality you're looking for?
It would be nice to have the current formatting that auto-generates with the blank _index.md
pages. Also, it seems that the {{% children description="true" %}}
shortcode doesn't properly generate summary descriptions (maybe because some of the subpages are blank at the moment).
I guess the codes for the current summary will be in the templates so I'll have a look there.
Ideally, I'd like to be able to put a simple intro text and image in the _index.md
page and then have the rest of the page autogenerate as it does now on a blank index page.
This is what your _index.md
page might look like
---
title: Section title
---
Intro text

{{% children description="true" %}}
You're right, it will show nothing if there is no description
front matter and no content in the md file. The {{% children description="true" %}}
shortcode will put whatever is in the description
front matter, and if it doesn't have that parameter then it will take the first few lines from the page's content.
I tried that but there are no descriptions at all if any of the child pages are blank. I guess it must be returning an error when it constructs the description array.
Hello, The current behavior is what @tarpdalton explained.
@zeigerpuppy, I don't really undestand your expectation, can you elaborate on this ?
The children shortcode is complex, i don't really want to touch it without being sure about the waited improvment.