Is there a way to merge all content


I am testing Hugo to generate static web sites and it works great!

I also need to create other files based on my content (PDF, Word, etc). Is there a way to “merge” all my content within a single .md file ? (With it, i can use Pandoc to generate other files).

Thanks a lot for your help.

Best regards

Not an answer for Markdown, but Org mode already does that.

I have all my site content in a single Org file. I can choose to export that whole file as PDF, ODF, etc. or have bits and pieces of that exported to the Hugo generated site.

To add to @kaushalmodi’s answer, another option would be to loop through all your pages, grab their title/content/etc, then print the generated html page as pdf (or convert it using pandoc).

Thanks for your replies

@kaushalmodi, i don’t use Org mode and it’s not really convenient in my case to work on a single file. My goal is to get one from the hierarchy.

@zwbetz sounds a good plan, but no idea how to achieve that ^^

Thanks again

That’s exactly what I am doing for an e-zine about role playing games. The single issues feature a couple of articles which all have a page of their own. For the PDF version I needed all articles on one page from which weasyprint generates the final pdf.

{{ range where .Parent.Data.Pages.ByWeight "Type" "article" }}
    <h1 class="article-header-all">{{ .Title }}</h1>
    <p class="description">{{ .Description }}</p>
    <p>{{ .Content }}</p>
{{ end }}

Issue main page:

Article sub page:

Print version:

Final pdf:ählspiel-Zine_Ausgabe_003.pdf


@holehan your use case is close to a future project I’m considering.

Specifically, combining Hugo and Weasyprint.

I’d love to know how you’re incorporating Weasyprint with Hugo. Are they both existing in a monorepo?

I have no familiarity with Python, but would love to incorporate Hugo with a host like Netlify and ideally have Weasyprint automatically generate PDFs on the server (when required) with each build.

Any info would be much appreciated! :slightly_smiling_face:

@Rasterisk The way I do it, there is no interaction between Hugo and Weasyprint. In fact weasyprint isn’t even part of my project files. Whenever I’m producing a new issue, I let Hugo/Netlify generate the html, then execute weasyprint manually to generate the pdf from the live site with e.g.

weasyprint document.pdf

1 Like

Maybe try it this way:

Thanks for the clarification! Much appreciated.