[print entire section] Relative links
The new "print entire section" is pretty cool. One limitation is that all media needs to have absolute links. This makes sense, but I didn't think about it until none of my media was showing. Most of my media uses a figure shortcode, so if I modify that, I can get absolute URLs. Note that I couldn't get absURL to work. I ended up using something like:
{{- $src := print .Site.BaseURL (.Page.File.Dir | path.Dir) "/" (.Get "src") -}}
How about adding a paragraph like the following to the Docsy docs? Any other suggestions? Note that I haven't tried the render-link idea.
Note that media needs to have absolute URLs. Relative URLs won't work because they will point to the wrong place. If you use a shortcode like figure for media, that can be adapted to convert relative URLs to absolute URLs. Relative links in Markdown have the same problem. This is less of an issue for printing, but if you're printing to a PDF, it's nice to have links that work. To handle relative links, it may be possible to use a render-link template to convert relative links to absolute links.
cc @gwatts
hey @tshort - how are you including your media currently? If you are loading it from a page resource, then you should be able to use that resource's RelPermalink attribute which will generate the correct URL in either case... you shouldn't need to manually construct URLs which, are fragile as you point out.
We're not using page resources. Media is kept in the same directory structure as the Markdown files, but they are not all at or below the current index.md file. The most common relative location is ../media/something.png, but we pull from other locations, too. Most media is accessed with a figure shortcode, but a few have direct HTML img tags.
{{- $src := print .Page.RelPermalink (.Get "src") -}}
works and is simpler than my kludge above. I still need to check for absolute links, though.
My images are also not showing on "print entire section" despite having tried the solutions @tshort provided. i updated my figure.html using above codes and yet no success. It only shows the images alt value