Skip to content

Allow "per type" Output Format assignment #5652

@regisphilibert

Description

@regisphilibert

Currently, output formats can only be assigned in batch to page kinds.

The Problem

This is problematic as there is no way for a user to assign an output format to only one type of content even though on many big scale projects, Output Formats are rarely shared by multiple content types.

Only current workaround is to simply include template files for the given output format exclusively in the chosen type layout directory and nowhere else.
This workaround used to be satisfactory, but now a sensible warning logs each absence of needed template file. On 5000 pages, this warning can be quite redundant and the user does not have any way to remove it.

Consider the following project:

Some content of type "event" needs to generate a calendar file.
The site sports + 5000 pages and a couple hundreds events.
With the current configuration, user can only add the calendar output format to every pages like the following, thus generating + 5000 calendar files :

outputs:
  home:
    - HTML
    - JSON
 page:
    - HTML
    - JSON
    - event_icf

Or, devise a system so the calendar output format is assigned through the Front Matter of each event md file rather than the site's configFile. Though this is problematic when non-developer content editor are in charge of creating them.

Proposal

Ideal solution would be for the user to keep using the current config syntax for current projects while allowing the use of maps instead of slices for « per type » configuration:

outputs:
  home:
    - HTML
    - JSON
 page:
    - HTML
 event:
    page:
       - event_icf
    section:
       - JSON

The values of the maps could either list every needed outputs for each type, or merge listed ones with the "per kind" configuration.

If the above seems to complex to implement we could also isolate "per type" config a new key: types.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions