hugo-theme-docdock icon indicating copy to clipboard operation
hugo-theme-docdock copied to clipboard

Augmenting index pages

Open zeigerpuppy opened this issue 7 years ago • 5 comments

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?

zeigerpuppy avatar Dec 28 '17 00:12 zeigerpuppy

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?

tarpdalton avatar Dec 28 '17 21:12 tarpdalton

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.

zeigerpuppy avatar Dec 29 '17 01:12 zeigerpuppy

This is what your _index.md page might look like

---
title: Section title
---

Intro text

![image](https://gohugo.io/apple-touch-icon.png)

{{% 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.

tarpdalton avatar Dec 30 '17 18:12 tarpdalton

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.

zeigerpuppy avatar Dec 31 '17 05:12 zeigerpuppy

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.

vjeantet avatar Jan 14 '18 14:01 vjeantet