# yaml-language-server: $schema=https://unpkg.com/@sveltia/cms@0.233.1/schema/sveltia-cms.json
#
# The CMS at /admin/. Members with read access to the repository edit in a
# fork of their own (Open Authoring), and each change reaches the repository
# as a pull request to review. Those with write access work on it directly,
# with a branch and a pull request per entry.
backend:
  name: github
  repo: avanian/avanian.net
  branch: main
  # Sveltia CMS Authenticator (avanian/sveltia-cms-auth), for "Sign In with
  # GitHub" through the GitHub App "avanian.net editor".
  base_url: https://cms-auth.avanian.net
  open_authoring: true
  # Required with Open Authoring on a private repository. The GitHub App's
  # tokens ignore it: they reach only the repositories the app is installed
  # on.
  auth_scope: repo
  commit_messages:
    openAuthoring: '{{message}} (by {{author-login}})'

publish_mode: editorial_workflow

media_folder: public/media
public_folder: /media

output:
  # Astro's schemas accept a missing optional field, not an empty one.
  omit_empty_optional_fields: true

# The folders and fields match the collections in src/content.config.ts.
collections:
  - name: members
    label: Members
    label_singular: Member
    description: Each member's page, at the path named after its file.
    folder: src/content/members
    extension: md
    create: true
    identifier_field: name
    slug: '{{name}}'
    fields:
      - { label: Name, name: name, widget: string }
      - { label: About, name: body, widget: markdown }

  - name: bios
    label: Bios
    label_singular: Bio
    description: Your path in life, in your own words, as much as you want public.
    folder: src/content/bios
    extension: md
    create: true
    identifier_field: member
    slug: '{{member}}'
    fields:
      - label: Member
        name: member
        widget: relation
        collection: members
        value_field: '{{slug}}'
        search_fields: [name]
        display_fields: [name]
      - { label: Bio, name: body, widget: markdown }

  - name: posts
    label: Posts
    label_singular: Post
    folder: src/content/posts
    extension: md
    create: true
    slug: '{{title}}'
    sortable_fields: [date, title]
    fields:
      - { label: Title, name: title, widget: string }
      - label: Author
        name: author
        widget: relation
        collection: members
        value_field: '{{slug}}'
        search_fields: [name]
        display_fields: [name]
      - { label: Date, name: date, widget: datetime, time_format: false, format: YYYY-MM-DD }
      - { label: Description, name: description, widget: string, required: false }
      - { label: Body, name: body, widget: markdown }
