Automatische PDF Generierung
Zur Verteilung der Inhalte an verschiedene Zielgruppen ist eine PDF Datei vorteilhaft. Diese könnte mit hilfe der Pipeline automatische generiert werden. Eine Anleitung für die Generierung kann man dem folgenden Link entnehmen. Anleitung in den Kommentaren
1. Create a new directory in the content directory. I’ve called it “all-content”.
2. Add a simple index.md file to that directory. The content is not important.
3. Right now, this new directory will use the default layout, which is not fine for our purpose. Create a directory with the same name in layouts; e.g., /layouts/all-content/. Now you can define a new layout for this page.
4. Create /layouts/all-content/list.html, with a layout that includes all pages on the website. Use my second reply to the original post above as a starting point and then refine it to match your preferences.
5. Create a build script to first build the website using Hugo, and then convert /public/all-content/index.html to pdf. Use my first reply above as a starting point and then adjust it to your need. You may need to install a few things such as wkhtmltopdf too.
6. Refine the rest of the website by excluding that page from the sitemap and RSS feed, etc.
Beispiel Layout aus dem Artikel:
<!DOCTYPE html>
<html lang="en">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# product: http://ogp.me/ns/product#">
<meta charset="utf-8">
<xbase href="file:///mnt/websites/xxxxxxxx/public">
<title>All the Posts!</title>
<style>
</style>
</head>
<body>
<h1>All the Posts!</h1>
<p>This is a copy of all posts on the website. To download the latest version, visit...</p>
<p>TOC:</p>
<ul>
{{ range .Site.RegularPages }}
<li><a href="#{{ substr .RelPermalink 1 -1 }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ range .Site.RegularPages }}
<h2 id="{{ substr .RelPermalink 1 -1 }}">{{ .Title }}</h2>
<p style=""><a href="{{ .Permalink }}">{{ .Permalink }}</a> - {{ .Params.sdate }}</p>
{{ .Content }}
{{ end }}
</body>
</html>