algoo / jfmengine

A soft fork of JSSG for algoo websites use case
Other
0 stars 0 forks source link

Add a setting for default metadata for contents #19

Closed lebouquetin closed 2 months ago

lebouquetin commented 3 months ago

Currently, users need to define all metadata even the repetitive ones.

Expected: allow to set a default value for a series of metadata.

A way to do so would be to define a default.metada text file with default content. At load time, this file is concatenated as the first lines of metadata so that:

Example:

Currently, we can overwritte a metadata:

--- METADATA (first) ---
title   galae - le service e-mail éthique et libre facturé à l'usage
slug    fr-index
slug    de-index

Will result with a slug metadata equal to de-index

So the behaviour would be:

default.metada file content:

lang            fr
template_engine jinja

And a content file:

--- METADATA (first) ---
title   galae - le service e-mail éthique et libre facturé à l'usage
slug    fr-index
slug    de-index

would result in a content equivalent to:

--- METADATA (first) ---
lang            fr
template_engine jinja
title           galae - le service e-mail éthique et libre facturé à l'usage
slug            de-index

the settings.py configuration file would contain 2 new parameters:

The order of include would be:

  1. read metadata from setting.py found in JFME_DEFAULT_METADATA_STRING
  2. read metadata from JFME_DEFAULT_METADATA_FILEPATH
  3. read from content file itself
ClmntBcqt commented 2 months ago

JFME_DEFAULT_METADATA_STRING is replaced by JFME_DEFAULT_METADATA_DICT which is a dictionary, for a better format in a python file. Example : JFME_DEFAULT_METADATA_DICT = {"slug": "index", "title": "Default title", "lang": "en"}

ClmntBcqt commented 2 months ago

Merged in #40