Commit 70acab2f by PLN (Algolia)

admin: split the blog collection per content file

Sveltia/Decap i18n structures (single_file, multiple_files,
multiple_folders) can neither produce <slug>/<locale>.md nor carry a
shared non-localized meta file, so the folder is exposed as three
monolingual entry collections pinned to their file by the path
template: blog -> <slug>/meta.md, blog-fr -> <slug>/fr.md, blog-en ->
<slug>/en.md. app_id and PKCE untouched.
parent 6a6670d9
......@@ -20,19 +20,63 @@ backend:
media_folder: public/images/blog
public_folder: /images/blog
# Blog content model: each post is a folder `content/blog/<slug>/` holding
# meta.md (shared metadata) + fr.md + en.md (one file per language, localized
# title + body). Sveltia/Decap i18n cannot express that layout: their i18n
# structures are single_file (all locales in <slug>.<ext>), multiple_files
# (<slug>.<locale>.<ext>) and multiple_folders (<locale>/<slug>.<ext>) — none
# produces <slug>/<locale>.md, and none has a notion of a shared,
# non-localized meta file. So instead of the i18n machinery, the folder is
# exposed as three monolingual entry collections sharing the same `folder`,
# each pinned to its file by the `path` template (which also keeps unrelated
# files out of each collection's list).
#
# Workflow: create a post under "Blog" (meta.md), then add its bodies under
# "Blog FR" / "Blog EN" — when creating there, type the post's slug (the
# folder name) so the files land in the same folder.
collections:
- name: blog
label: Blog
label_singular: Post
folder: content/blog
path: "{{slug}}/meta"
create: true
editor:
preview: false
fields:
- { label: Title, name: title, widget: string }
- { label: Date, name: date, widget: datetime, format: 'YYYY-MM-DD', date_format: 'YYYY-MM-DD', time_format: false }
- { label: Slug, name: slug, widget: string, required: false, hint: 'Kebab-case; must match the filename (content/blog/<slug>.md)' }
- { label: Description, name: description, widget: string, required: false }
- { label: Tags, name: tags, widget: list, required: false, default: [] }
- { label: Draft, name: draft, widget: boolean, default: false }
- { label: Share token, name: share, widget: string, required: false, pattern: ['^[a-z0-9]{2,16}$', 'Lowercase letters and digits only'], hint: '6-char token for the unlisted /blog/d/<slug>-<token> link — node scripts/new-share-token.mjs' }
- name: blog-fr
label: Blog FR
label_singular: Post (FR)
folder: content/blog
path: "{{slug}}/fr"
create: true
editor:
preview: false
summary: "{{dirname}} — {{title}}"
fields:
- { label: Title, name: title, widget: string }
- { label: Description, name: description, widget: string, required: false }
- { label: Body, name: body, widget: markdown }
# `{{slug}}` on creation comes from the entry slug editor — type the post's
# folder name there; opening an existing file always resolves it correctly.
- name: blog-en
label: Blog EN
label_singular: Post (EN)
folder: content/blog
path: "{{slug}}/en"
create: true
editor:
preview: false
summary: "{{dirname}} — {{title}}"
fields:
- { label: Title, name: title, widget: string }
- { label: Description, name: description, widget: string, required: false }
- { label: Body, name: body, widget: markdown }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment