Inside a theme I defined a custom output format to create a printer-friendly template:
outputFormats:
print:
isHTML: true
mediaType: text/html
path: _print
With my theme I do have a custom template file layouts/mysection/list.print.html
for generation of the print preview. This template file ranges over all pages inside the section and recursively concatenates all page contents into one single list, using {{ .Page.Content }}
inside my loop.
I now use my custom print output format with a site that uses my theme:
outputs:
home: [HTML]
page: [HTML]
section: [HTML, RSS, print]
If I do have a content file content/mysection/index.md
I now can invoke the print preview for this page via the URL mysite.tld/mysection/_print
. Everthing works fine for pages without page resources.
However when using page bundles with page resources, the rendered links to the page resources are broken: the rendered html output of my print preview list links to path/to/myimage.png
, while it should be _print/path/to/myimage.png
. Consequently, inside my preview, all links to page resources are broken.
The root cause ist that {{ .Page.Content }}
used inside my print preview template does not know about/consider the _print
path prefix that is used with all URLs for page preview. Is there any way to make these links work?