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).
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).
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" }}
<div>
<h1 class="article-header-all">{{ .Title }}</h1>
<p class="description">{{ .Description }}</p>
<p>{{ .Content }}</p>
</div>
{{ end }}
@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.
@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.