Skip to content

Conversation

@takusuman
Copy link

  • Generate a ToC on the top of the page, using "params.BookSection" as a way to have the ToC only from a certain section or the entire book (as suggested by @b4u-mw);
  • "Hammer" the contents of each page on the list above in a single page (docsy's layouts/_partials/print may be of inspiration);
  • Create a way to link from the ToC to the contents below (<a name=..>, as also suggested by @b4u-mw);
  • Finally, write a stylesheet for this printable page.

@takusuman
Copy link
Author

@alex-shpak Pardon for bothering, but could I have more clues besides what you've given at the #764 issue?
I've got the outputFormat configured along with a prototype button for printing the page but, when I get to the "print.html" page (ex.: docs/example//print.html), I get a "Page not found" message, meaning that the print page isn't being actually generated following the layouts/list.print.html I've made.
I don't have a lot of experience with Hugo yet, so it must be a really stupid error from my part.

@takusuman
Copy link
Author

The funny thing here: Hugo recognizes the new "print" output format, but it refuses to generate output pages for it, even with it inside layouts/ for some reason...

@alex-shpak
Copy link
Owner

Hello!
Long story short, Hugo can't create pages out of nothing. Output types only control in which kind of outputs Hugo can write the page. So you need to create something like content.en/print.md or similar.

But I don't think it is good to make it as an output type, I would rather have it as special layout like landing page. So theme users could choose if they want single page output.
Keep in mind that single page output could affect sites with a lot of pages, so I think it should be optional.

@arthurbacci
Copy link

arthurbacci commented Oct 22, 2025

Hello! Long story short, Hugo can't create pages out of nothing. Output types only control in which kind of outputs Hugo can write the page. So you need to create something like content.en/print.md or similar.

But I don't think it is good to make it as an output type, I would rather have it as special layout like landing page. So theme users could choose if they want single page output. Keep in mind that single page output could affect sites with a lot of pages, so I think it should be optional.

In theory it's possible to print an entire section by making a printable section.print.html that, instead of listing stuff, it just concatenates all their contents. Isn't it? I think this is what takusuman means. If it's the entire website then it's a bit more difficult I guess.

@takusuman
Copy link
Author

In theory it's possible to print an entire section by making a printable section.print.html that, instead of listing stuff, it just concatenates all their contents. Isn't it?

Precisely! It's exactly what #778 meant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants