Skip to content

Don't duplicate page resource output per language #11453

@bep

Description

@bep

We're planning on some big improvements for the next Hugo. A part of that is to make Hugo simpler and more effective in the way we handle content, also to pave away for features going forward. And with that comes some changes which some may consider breaking, more would consider bug fixes.

Given this example content folder and 2 languages defined:

content
└── mybundle
    ├── data.en.json
    ├── index.en.md
    ├── index.no.md
    └── sunset.en.jpg

In the current version of Hugo we would duplicate the output so you would get:

public
├── en
│   └── mybundle
│       ├── data.json
│       ├── index.html
│       └── sunset.jpg
└── no
    └── mybundle
        ├── data.json
        ├── index.html
        └── sunset.jpg

The original implementation of the above preceded render hooks and the main motivation was that you should be able to have links that worked both on GitHub and when rendered in Hugo, even across languages.

We would still be able to apply language specific params/name/title per resource, but .RelPermalink would point to the same file. If you need a different file for a given language, you can easily create a language specific version (e.g. data.no.json).

There's several reasons why the above is a great idea:

  • It reduces duplication, which is especially true for bigger files (e.g. images).
  • It allows us to to relatively cheaply add new build dimensions in addition to languages (e.g. roles)
  • Also, when we "stop caring" about where these objects lives on the file system (stop hard coding URLs), we can optimise further by de-duplication (e.g. publish all images to one folder named by their content hash).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions