hextra icon indicating copy to clipboard operation
hextra copied to clipboard

Can I avoid adding _index in the docs?

Open mlosun opened this issue 1 year ago • 5 comments

Great theme, I started using it as soon as I saw it.

However, I don't really want each directory to have its own page; I only want to use _index to add a directory page when I need it.

Alternatively, this directory page could automatically generate an index instead of me manually adding each document.

Also, in the sidebar, clicking should directly expand the documents (or there could be a setting to make this directory default to being expanded).

Is this achievable?

mlosun avatar Dec 01 '24 16:12 mlosun

However, I don't really want each directory to have its own page; I only want to use _index to add a directory page when I need it.

you don't necessarily need an _index.md file for each directory. see: https://gohugo.io/content-management/organization/#organization-of-content-source

Alternatively, this directory page could automatically generate an index instead of me manually adding each document.

not sure that this is possible in Hugo, as it only generates an index page when there's _index.md file presents

Also, in the sidebar, clicking should directly expand the documents (or there could be a setting to make this directory default to being expanded).

there are settings to expand an item in the sidebar: https://github.com/imfing/hextra/blob/86a1f3fd9638a65c70fb7892964a396df22409a0/exampleSite/content/docs/guide/_index.md?plain=1#L6-L7

imfing avatar Dec 04 '24 07:12 imfing

WX20241208-155405 WX20241208-155415

Thanks, the issue with expanding the sidebar has been resolved.

Regarding the _index.md issue, when there is no _index.md in a directory, the other articles in that directory are displayed flat on the frontend rather than being nested within the directory structure. I would prefer for them to maintain the same directory hierarchy as in the source files, without needing an index page.

(Actually, I don't want to spend time writing or frequently adjusting index pages, which is why I brought up the idea of either removing the index page or automatically generating its content.I think this approach might help me (or others) focus more on the content itself.)

mlosun avatar Dec 08 '24 07:12 mlosun

Regarding the _index.md issue, when there is no _index.md in a directory, the other articles in that directory are displayed flat on the frontend rather than being nested within the directory structure. I would prefer for them to maintain the same directory hierarchy as in the source files, without needing an index page.

It makes sense. I have a WIP #376 that generates the sidebar from a file, rather than inferring from the folder structure, which is not very flexible.

imfing avatar Dec 08 '24 12:12 imfing

I have been looking a bit at this myself, and found the following in Hugos documentation that does not work with Hextra.

https://gohugo.io/content-management/build-options/#example----publish-without-listing

When I do this it hides the section completely.

phillebaba avatar Jan 02 '25 11:01 phillebaba

I have been looking a bit at this myself, and found the following in Hugos documentation that does not work with Hextra.

https://gohugo.io/content-management/build-options/#example----publish-without-listing

When I do this it hides the section completely.

I'm experiencing similar issue:

I'm importing content from an external repo as a hugo module. The external repo organizes content in a directory tree, with YYYY/MM/DD.md structure. The goal is to publish each of the daily pages; we want to use Hextra's docs layout to help navigate our directory tree, but without having an interim viewable page for the year/month parent directories.

We've added frontmatter to each of the directory _index.md files per the 'publish without listing' hugo docs.

---
title: April
build:
  list: never
  render: never
---

Each content page's frontmatter looks like:

---
title: 27 April 2025
date: 2025-04-27
type: docs
---

In this case, the sidebar never appears.

ahgraber avatar Apr 27 '25 21:04 ahgraber