Hello,
I have a Hugo website that I use for documentation.
I would like to users to be able to print the full documentation at once.
I am looking to render all the pages and generate one HTML. Anyone has already done that?
Thanks
Hello,
I have a Hugo website that I use for documentation.
I would like to users to be able to print the full documentation at once.
I am looking to render all the pages and generate one HTML. Anyone has already done that?
Thanks
You can render any page collection on whatever HTML page with:
Grouped by first-level section, then sorted by page title, this displays the .Title
and .Content
of each page.
layouts/_default/list.html (or some other list template)
{{ range site.Sections.ByWeight }}
<h1>{{ .Title }}</h1>
{{ range .RegularPagesRecursive.ByTitle }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Content }}
{{ end }}
Seems simple enough, but take this example:
content
βββ books/
β βββ book-1.md
β βββ book-2.md
β βββ _index.md
βββ films/
βββ film-1/
β βββ index.md <-- contains markdown ![Poster](poster.jpg)
β βββ poster.jpg
βββ film-2.md
βββ _index.md
In the absence of an image render hook that rewrites the image src
attribute for portability, the βposterβ image will be broken when we render films/film-1/index.md
. The image will be broken because the src
attribute is relative to film-1
.
The same is true for links.
Additionally, without a heading render hook to create globally unique heading id
attributes, link fragments (example: [list of actors](#actors)
) in your markdown may have an indeterminate target. For example, taking the content structure above, it is likely that each film will have the same headings, for example:
### Actors
### Awards
### Plot
There are similar challenges with code block line anchors, footnotes, etc.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.