# Decap CMS config for meshtexas-site.

backend:
  name: github
  repo: anieto/meshtexas-site
  branch: main
  # Without base_url, Decap defaults to Netlify's own OAuth proxy host —
  # since we're not on Netlify, that 404s. Must be set explicitly.
  base_url: https://meshtexas.org
  auth_endpoint: /api/auth        # served by the Pages Function above
  # public_repo scope is enough now that the repo is public — avoids
  # asking contributors' GitHub OAuth consent for full private-repo access.
  auth_scope: public_repo
  # Lets any GitHub user submit without being added as a repo collaborator:
  # Decap auto-forks the repo for them, and their submission becomes a PR
  # from their fork into `main`. They only ever see Draft / Ready to Review —
  # no publish button. Requires editorial_workflow (below) to function.
  # Must be nested under `backend:` — a top-level open_authoring key is
  # silently ignored, which is exactly what broke this the first time.
  open_authoring: true

publish_mode: editorial_workflow

media_folder: "public/images"
public_folder: "/images"

collections:
  - name: "articles"
    label: "Articles"
    label_singular: "Article"
    description: "Open to anyone — every submission is reviewed by an admin before it publishes. See the [Contributing Guide](https://meshtexas.org/contribute/) for what the fields below mean."
    folder: "src/content/articles"
    create: true
    slug: "{{slug}}"
    identifier_field: title
    fields:
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Short description", name: "description", widget: "text", hint: "One or two sentences, used on the index/listing page." }
      - label: "Category"
        name: "category"
        widget: "select"
        hint: "See the [Contributing Guide](https://meshtexas.org/contribute/#categories) for what each category covers."
        options:
          - { label: "How-To", value: "how-to" }
          - { label: "Buildout / Infrastructure", value: "buildout" }
          - { label: "Community", value: "community" }
          - { label: "Announcement", value: "announcement" }
      - label: "Region(s)"
        name: "region"
        widget: "select"
        multiple: true
        required: false
        hint: "The same codes used on the [Connect](https://meshtexas.org/connect) page (e.g. SAT = San Antonio, AUS = Austin). Leave blank for statewide content."
        options: ["AUS", "SAT", "HOU", "DFW", "ELP", "ABI", "AMA", "MFE", "SJT", "TXK", "CRP", "ACT"]
      - { label: "Author", name: "author", widget: "string", required: false }
      - { label: "Published date", name: "publishedAt", widget: "datetime", format: "YYYY-MM-DD" }
      - { label: "Thumbnail", name: "thumbnail", widget: "image", required: false }
      - { label: "Body", name: "body", widget: "markdown" }

  - name: "host-a-node"
    label: "Host a Node (Admin Only)"
    label_singular: "Page"
    description: "Managed directly by MeshTexas admins — please don't submit new entries here. If you have something for this section, email info@meshtexas.org instead."
    folder: "src/content/host-a-node"
    create: true
    slug: "{{slug}}"
    identifier_field: title
    fields:
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Short description", name: "description", widget: "text", hint: "One or two sentences, e.g. for a nav/card summary." }
      - { label: "Thumbnail", name: "thumbnail", widget: "image", required: false }
      - { label: "Body", name: "body", widget: "markdown" }
