Show Default Language Content

Hello,

I’m currently working on making my site multilang and have decided to go the content directory route. I’ve been able to solve the few issues I’ve ran into except this one. This following code works and shows the posts for the selected language but obviously if there are no posts than nothing is shown. I’m not sure how to force Hugo to pull the content from the default languages folder.

The next step after this would be getting Hugo to check and if there is a translated version of the post then to use that one instead of the default English one but one step at a time I suppose.

{{ range first 4 (where .Site.Pages "Section" "blog") }}

Blog Content

{{ end }}

Any help or insight would be greatly appreciated!

A friend was able to help me out.


{{ $pages := .Site.Pages }}
{{ range .Site.Home.Translations }}
{{ $pages = $pages | lang.Merge .Site.Pages }}
{{ end }}

{{ range first 4 (where $pages "Section" "blog") }}

Blog Content

{{ end }}

Funny thing is I tried this earlier but had $pages.lang.Merge and didn’t see my problem…

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