Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a setting for default metadata for contents #19

Closed
lebouquetin opened this issue Jun 27, 2024 · 2 comments
Closed

Add a setting for default metadata for contents #19

lebouquetin opened this issue Jun 27, 2024 · 2 comments

Comments

@lebouquetin
Copy link
Member

lebouquetin commented Jun 27, 2024

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:

  • default values are available
  • default values may be overwritten by value defined in the content itself.

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:

  • JFME_DEFAULT_METADATA_FILEPATH = <path> which links to the file on the disk. The file is a text file without any header: only lines of metadata <metadata_name> <metadata_value>
  • JFME_DEFAULT_METADATA_STRING = "" which gives direct access to configuring default metadata in settings.py.

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
Copy link
Contributor

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
Copy link
Contributor

Merged in #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants