# Sveltia CMS configuration – editing interface at /admin/
# Docs: https://sveltiacms.app/en/docs
# The website itself is Czech; the admin interface is English.

backend:
  name: github
  repo: pavelstrelec-debug/atletikasparta-web
  branch: main
  # "Sign In with GitHub" goes through this login helper (sveltia-cms-auth on Cloudflare Workers)
  base_url: https://sveltia-cms-auth.pavelstrelec.workers.dev
  commit_messages:
    create: 'Create {{collection}} “{{slug}}”'
    update: 'Update {{collection}} “{{slug}}”'
    delete: 'Delete {{collection}} “{{slug}}”'
    uploadMedia: 'Upload {{path}}'
    deleteMedia: 'Delete {{path}}'

site_url: https://atletikasparta.cz
display_url: https://atletikasparta.cz
logo_url: /img/logo.png

# New uploads (photos, PDFs). Files migrated from WordPress stay in /wp-content/uploads.
media_folder: public/uploads
public_folder: /uploads

media_libraries:
  default:
    config:
      max_file_size: 20000000 # 20 MB
      # Phone photos are resized and converted to WebP on upload
      transformations:
        raster_image:
          format: webp
          quality: 85
          width: 2000
          height: 2000

slug:
  encoding: ascii
  clean_accents: true
  sanitize_replacement: '-'

collections:
  - name: aktuality
    label: News
    label_singular: News post
    description: News on the home page, newest first.
    folder: src/content/aktuality
    create: true
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    summary: '{{title}} ({{date | date("D MMM YYYY")}})'
    sortable_fields: [date, title]
    sort_by: { field: date, direction: descending }
    media_folder: /public/uploads/aktuality
    public_folder: /uploads/aktuality
    fields:
      - { name: title, label: Title, widget: string }
      - { name: date, label: Date, widget: datetime, format: 'YYYY-MM-DDTHH:mm:ss', default: '{{now}}' }
      - name: fotky
        label: Photos
        hint: The first photo is the thumbnail in the news list. All photos are shown as a gallery below the text.
        widget: image
        multiple: true
        required: false
      - { name: body, label: Text, widget: markdown }

  - name: galerie
    label: Photo gallery
    label_singular: Album
    folder: src/content/galerie
    create: true
    slug: '{{slug}}'
    summary: '{{title}} ({{date | date("MMM YYYY")}})'
    sortable_fields: [date, title]
    sort_by: { field: date, direction: descending }
    media_folder: /public/uploads/galerie
    public_folder: /uploads/galerie
    fields:
      - { name: title, label: Album title, widget: string }
      - { name: date, label: Date, widget: datetime, format: 'YYYY-MM-DD', time_format: false }
      - { name: fotky, label: Photos, widget: image, multiple: true }
      - { name: body, label: Description (optional), widget: markdown, required: false }

  - name: stranky
    label: Pages
    label_singular: Page
    description: Static pages (O klubu, Kontakt, Dokumenty…). A new page appears in the menu only after you add it under Settings → Menu.
    folder: src/content/stranky
    create: true
    slug: '{{slug}}'
    fields:
      - { name: title, label: Title, widget: string }
      - { name: wp_id, label: Old WordPress ID, widget: hidden, required: false }
      - { name: body, label: Content, widget: markdown }

  - name: nastaveni
    label: Settings
    editor: { preview: false }
    files:
      - name: menu
        label: Menu
        file: src/data/menu.json
        fields:
          - name: polozky
            label: Menu items
            widget: list
            summary: '{{fields.nazev}}'
            fields:
              - { name: nazev, label: Label, widget: string }
              - { name: odkaz, label: Link, widget: string, hint: 'E.g. /kontakt/ for a page on this site, or a full https://… address for another site' }
              - name: podpolozky
                label: Submenu
                widget: list
                required: false
                summary: '{{fields.nazev}}'
                fields:
                  - { name: nazev, label: Label, widget: string }
                  - { name: odkaz, label: Link, widget: string }

      - name: web
        label: Sidebar & contacts
        file: src/data/nastaveni.json
        fields:
          - { name: nazev, label: Club name, widget: string }
          - { name: podtitul, label: Tagline, widget: string }
          - { name: popis, label: Site description (for search engines), widget: text }
          - { name: email, label: Email, widget: string }
          - { name: telefon, label: Phone, widget: string }
          - { name: facebook, label: Facebook URL, widget: string, required: false }
          - { name: instagram, label: Instagram URL, widget: string, required: false }
          - name: boxy
            label: Sidebar boxes
            widget: list
            summary: '{{fields.nadpis}}'
            fields:
              - { name: nadpis, label: Heading, widget: string }
              - { name: text, label: Text, widget: markdown }
          - name: partneri
            label: Partners
            widget: list
            summary: '{{fields.nazev}}'
            fields:
              - { name: nazev, label: Name, widget: string }
              - { name: logo, label: Logo, widget: image, required: false, media_folder: /public/uploads/partneri, public_folder: /uploads/partneri }
              - { name: odkaz, label: Link, widget: string, required: false }
