How to load page bundle resources in default anguage?

How to load page bundle markdown resources in default instead of current translation language?

Example page bundle:


I need to include the page resources A, B, C in both default and German language pages. Instead, Hugo looks for, etc., doesn’t find them, and displays nothing.

Don’t get me wrong, this is a very nice feature otherwise, but in my particular case I need to display a grammar exercise in a third language, and it has to be the same across the translations from Hugo’s perspective. Having these resources in markdown is also important.

The best idea I’ve got so far is to iterate through all translations of the ‘main’ page, and then the resources are picked up:

{{ range .AllTranslations }}
{{ range .Resources.Match "*.md" }} 

… but it’s ugly. Any better way to accomplish the same thing?

I suppose you could try using something like

{{ $p := .Sites.First.GetPage "<path-to-page>" }}
{{ with $p }}
<--- fetch the resources --->
{{ end }}

I think the solution is to move “language-indifferent” markdown resources into *.txt files, and then cunningly surprise Hugo by markdownifying them:

{{ range .Resources.Match "*.txt" }}
{{ .Content | markdownify }}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.