# Decap CMS 配置
# 网站管理页面：https://baist-lab.github.io/admin/

backend:
  name: github
  repo: BAIST-Lab/BAIST-Lab.github.io
  branch: main
  # OAuth 代理地址（免费部署在 Render）
  base_url: https://lab-site-oauth.onrender.com
  auth_endpoint: auth

# 上传图片保存位置
media_folder: "images/site-appearance"
public_folder: "images/site-appearance"

site_url: https://baist-lab.github.io/
display_url: https://baist-lab.github.io/

# 后台界面语言
locale: zh_Hans

# 自定义图片媒体库：上传后默认保存为 WebP，并自动缩放、压缩和裁剪（由 admin/media-library.js 提供）
media_library:
  name: imagelib
  config:
    format: image/webp
    max_width: 1920
    quality: 85

# 通用编辑器设置：Jekyll 页面无法实时预览，关闭预览
editor:
  preview: false

# 文件名编码：使用 unicode，保留中文等非 ASCII 字符（避免上传图片名被清空）
slug:
  encoding: unicode

collections:
  # =====================================================
  # 新闻动态（主页「最新进展」）
  # =====================================================
  - name: posts
    label: 新闻动态
    label_singular: 新闻
    description: 编写实验室新闻（标题、类型、摘要、照片、详情和发布时间），主页「最新进展」自动按发布时间倒序展示，点击卡片进入详情页。
    media_folder: "/images/news"
    public_folder: "images/news"
    folder: _posts/
    create: true
    delete: true
    extension: md
    format: yaml-frontmatter
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    summary: "{{title}} / {{title_en}}"
    sortable_fields: [date, commit_date, title, title_en]
    fields:
      - {label: 中文标题（中文版主页卡片及详情页显示）, name: title, widget: string}
      - {label: English Title（英文版主页卡片及详情页显示）, name: title_en, widget: string}
      - label: 照片（主页卡片左侧显示）
        name: image
        widget: image
        required: false
        hint: 上传时默认按新闻卡片的 8:5 比例裁剪，可拖动选择保留区域；保存为最大 1200 × 750 的 WebP。
        media_library:
          config:
            crop_ratio: 1.6
            crop_label: 新闻卡片 8:5
            max_width: 1200
            quality: 85
      - label: 详情图片（可多张）
        name: detail_images
        widget: list
        required: false
        hint: 可添加任意数量的图片并拖动调整顺序；图片按此顺序显示在详情正文之后。每张图片上传时均可自由裁剪。
        field:
          label: 图片
          name: image
          widget: image
          media_library:
            config:
              max_width: 1600
              quality: 85
      - {label: 发布时间（自动按此从新到旧排列）, name: date, widget: datetime, format: YYYY-MM-DD}
      - label: 类型
        name: news_type
        widget: object
        fields:
          - label: 类型选项
            name: preset
            widget: select
            options:
              - {label: 论文发表 / Publication, value: paper}
              - {label: 学术活动 / Academic Activity, value: academic}
              - {label: 获批项目 / Funded Project, value: project}
              - {label: 获奖荣誉 / Award & Honor, value: award}
              - {label: 自定义 / Custom, value: custom}
          - label: 自定义类型
            name: custom
            widget: object
            required: false
            hint: 选择“自定义 / Custom”时填写。
            fields:
              - {label: 中文名称, name: zh, widget: string, required: false}
              - {label: English Name, name: en, widget: string, required: false}
      - label: 摘要
        name: summary_text
        widget: object
        hint: 显示在首页新闻卡片中，网页上不会显示“摘要”二字。
        fields:
          - {label: 中文, name: zh, widget: text}
          - {label: English, name: en, widget: text}
      - label: 详情附件（单个文档）
        name: attachment
        widget: file
        required: false
        hint: 仅用于单个 Word、Markdown 或 PDF 等文档，不用于新闻图片。如需图片，请使用上方的“详情图片（可多张）”。Markdown 文档会在详情页直接渲染显示，其他文档显示为「下载附件」按钮。
      - label: 详情正文
        name: details
        widget: object
        hint: 中文与 English 分开填写，均支持 Markdown 和插入图片。
        fields:
          - {label: 中文, name: zh, widget: markdown, required: false}
          - {label: English, name: en, widget: markdown, required: false}

  # =====================================================
  # 团队成员
  # =====================================================
  - name: members
    label: 团队成员
    label_singular: 成员
    description: 编辑团队成员的姓名、照片、职称与简介。
    media_folder: "/images/team"
    public_folder: "images/team"
    folder: _members/
    create: true
    delete: true
    extension: md
    format: yaml-frontmatter
    identifier_field: title
    slug: "{{slug}}"
    summary: "{{name.zh}} / {{name.en}}"
    sortable_fields: [commit_date, date, title]
    fields:
      - {label: 英文姓名（用于网址文件名）, name: title, widget: string}
      - label: 姓名
        name: name
        widget: object
        fields:
          - {label: 中文名, name: zh, widget: string}
          - {label: English, name: en, widget: string}
      - label: 照片
        name: image
        widget: image
        required: false
        hint: 上传时默认按成员头像的 1:1 比例裁剪，可拖动选择保留区域；保存为最大 480 × 480 的 WebP。
        media_library:
          config:
            crop_ratio: 1
            crop_label: 成员头像 1:1
            max_width: 480
            quality: 85
      - {label: 邮箱, name: email, widget: string, required: false}
      - {label: 入学 / 加入时间（用于成员排序）, name: date, widget: datetime, format: YYYY-MM-DD, required: false}
      - label: 类别
        name: role
        widget: select
        options:
          - {label: 教授 / 负责人, value: professor}
          - {label: 博士后, value: postdoc}
          - {label: 教师, value: teacher}
          - {label: 博士生, value: phd}
          - {label: 硕士生, value: master}
          - {label: 本科生, value: undergrad}
          - {label: 已毕业成员, value: graduate}
      - label: 职称 / 年级
        name: description
        widget: object
        required: false
        fields:
          - {label: 中文, name: zh, widget: string}
          - {label: English, name: en, widget: string}
      - label: 其他信息
        name: other_info
        widget: list
        required: false
        hint: 可添加多项；网站会按这里的顺序显示在“职称 / 年级”下方。
        summary: "{{fields.zh}} / {{fields.en}}"
        fields:
          - {label: 中文, name: zh, widget: string}
          - {label: English, name: en, widget: string, required: false}
      - label: 姓名别名（用于论文检索）
        name: aliases
        widget: list
        required: false
        summary: "{{fields.alias}}"
        field: {label: 别名, name: alias, widget: string}
      - {label: 个人主页链接（填写后显示，留空则不显示）, name: homepage, widget: string, required: false}
      - label: 其他链接（社交等，可选）
        name: links
        widget: map
        key_type: string
        value_type: string
        required: false
      - label: 个人简介
        name: bio
        widget: object
        hint: 中文与 English 分开填写，均支持 Markdown。
        fields:
          - {label: 中文, name: zh, widget: markdown, required: false}
          - {label: English, name: en, widget: markdown, required: false}

  # =====================================================
  # 研究成果
  # =====================================================
  - name: projects
    label: 研究成果
    label_singular: 研究成果
    description: 管理「研究成果」页下方的研究课题列表；代表工作卡片在本栏目下方的「代表工作」子内容中单独管理。
    media_folder: "/images/projects"
    public_folder: "images/projects"
    folder: _projects/
    create: true
    delete: true
    extension: md
    format: yaml-frontmatter
    identifier_field: title
    slug: "{{slug}}"
    summary: "{{name.zh}} / {{name.en}}"
    sortable_fields: [commit_date, start_date, end_date, title]
    fields:
      - {label: 项目英文简称（用于网址文件名）, name: title, widget: string, hint: 仅用于后台识别和生成网址，不在网页正文中显示。}
      - label: 项目名称
        name: name
        widget: object
        fields:
          - {label: 中文, name: zh, widget: string}
          - {label: English, name: en, widget: string}
      - label: 项目来源
        name: source
        widget: object
        fields:
          - {label: 中文, name: zh, widget: string}
          - {label: English, name: en, widget: string}
      - {label: 项目开始月份, name: start_date, widget: datetime, date_format: "YYYY-MM", time_format: false}
      - {label: 项目结束月份, name: end_date, widget: datetime, date_format: "YYYY-MM", time_format: false}
      - label: 参与角色
        name: role
        widget: object
        fields:
          - {label: 中文, name: zh, widget: string}
          - {label: English, name: en, widget: string}

  # =====================================================
  # 研究成果 > 代表工作分类
  # =====================================================
  - name: featured_categories
    label: 代表工作分类
    label_singular: 代表工作分类
    description: 管理「代表工作」的分类名称和前台显示顺序；空分类不会显示在网页中。
    folder: _featured_categories/
    create: true
    delete: true
    extension: md
    format: yaml-frontmatter
    identifier_field: title
    slug: "{{slug}}"
    summary: "{{name.zh}} / {{name.en}}"
    sortable_fields: [commit_date, order, title]
    fields:
      - {label: 分类标识, name: title, widget: string, pattern: ['^[a-z0-9]+(?:-[a-z0-9]+)*$', '请使用小写英文字母、数字和连字符'], hint: 例如 spatiotemporal-foundation-models；代表工作使用该标识建立关联，创建后不建议修改。}
      - label: 分类名称
        name: name
        widget: object
        fields:
          - {label: 中文, name: zh, widget: string}
          - {label: English, name: en, widget: string}
      - {label: 显示顺序, name: order, widget: number, value_type: int, min: 1, default: 10, hint: 数字越小越靠前。}

  # =====================================================
  # 研究成果 > 代表工作
  # =====================================================
  - name: featured_publications
    label: 代表工作
    label_singular: 代表工作
    description: 「研究成果」的子内容；按研究方向管理 Featured Works 卡片及其详情页。
    media_folder: "/images/featured-works"
    public_folder: "images/featured-works"
    folder: _featured_publications/
    create: true
    delete: true
    extension: md
    format: yaml-frontmatter
    identifier_field: title
    slug: "{{slug}}"
    summary: "{{name.zh}} / {{name.en}}"
    sortable_fields: [commit_date, title, category]
    fields:
      - {label: 工作英文简称（用于网址文件名）, name: title, widget: string, hint: 仅用于后台识别和生成网址，不在网页正文中显示。}
      - label: 分类
        name: category
        widget: relation
        collection: featured_categories
        search_fields: [title, name.zh, name.en]
        value_field: title
        display_fields: [name.zh, name.en]
        hint: 从「代表工作分类」中选择；需要新分类时请先到分类管理中创建。
      - label: 名称
        name: name
        widget: object
        fields:
          - {label: 中文, name: zh, widget: string}
          - {label: English, name: en, widget: string}
      - label: 会议 / 期刊 / 项目来源
        name: venue
        widget: object
        fields:
          - {label: 中文, name: zh, widget: string}
          - {label: English, name: en, widget: string}
      - label: 图片
        name: image
        widget: image
        required: false
        hint: 可选；未上传时显示统一占位图。上传时默认按代表工作卡片的 16:10 比例裁剪，可拖动选择保留区域；保存为最大 1280 × 800 的 WebP。
        media_library:
          config:
            crop_ratio: 1.6
            crop_label: 代表工作卡片 16:10
            max_width: 1280
            quality: 85
      - label: 摘要
        name: summary_text
        widget: object
        hint: 显示在代表工作卡片中。
        fields:
          - {label: 中文, name: zh, widget: text}
          - {label: English, name: en, widget: text}
      - {label: 代码链接, name: code, widget: string, required: false, hint: 可选；未填写时，卡片和详情页中的“代码 / Code”按钮显示为灰色不可点击状态。}
      - {label: 数据链接, name: data_link, widget: string, required: false, hint: 可选；未填写时，卡片和详情页中的“数据 / Data”按钮显示为灰色不可点击状态。}
      - {label: 链接, name: link, widget: string, required: false, hint: 可选；未填写时，卡片和详情页中的“链接 / Link”按钮显示为灰色不可点击状态。}
      - label: 详细介绍
        name: details
        widget: object
        hint: 显示在点击卡片进入的详情页中，支持 Markdown 和插入图片。
        fields:
          - {label: 中文, name: zh, widget: markdown}
          - {label: English, name: en, widget: markdown}

  # =====================================================
  # 发表论著
  # =====================================================
  - name: citations
    label: 发表论著
    label_singular: 论文
    description: 编辑「发表论著」页展示的论文列表。
    files:
      - name: citations
        label: 论文列表
        file: _data/citations.yaml
        fields:
          - label: 论文
            name: items
            widget: paperlist
            hint: 输入标题或 DOI 可自动获取作者、日期、期刊/会议等信息；未命中或需微调时可手动修改。
            fields:
              - {label: ID（DOI 或备注）, name: id, widget: string, required: false}
              - {label: 标题, name: title, widget: string}
              - label: 作者
                name: authors
                widget: list
                field: {label: 作者, name: author, widget: string}
              - {label: 发表期刊 / 会议, name: publisher, widget: string, required: false}
              - {label: 发表日期（YYYY-MM-DD）, name: date, widget: datetime, format: YYYY-MM-DD}
              - {label: 链接（DOI 或网址）, name: link, widget: string, required: false}
              - {label: GitHub 代码链接, name: code, widget: string, required: false}
              - {label: PDF 链接, name: pdf, widget: string, required: false}
              - label: 类型
                name: type
                widget: select
                default: conference
                options:
                  - {label: 会议 C, value: conference}
                  - {label: 期刊 J, value: journal}

  # =====================================================
  # 网站外观（主页顶部 / 页脚背景图）
  # =====================================================
  - name: appearance
    label: 网站外观
    label_singular: 外观
    description: 管理首页导航栏下方的轮播大图与页脚背景图；轮播图可添加任意数量并调整顺序。
    media_folder: "/images/site-appearance"
    public_folder: "images/site-appearance"
    files:
      - name: appearance
        label: 网站外观
        file: _data/site.yaml
        fields:
          - label: 首页轮播图
            name: header_images
            widget: list
            required: false
            hint: 可添加任意数量的图片；拖动条目可调整网页中的轮播顺序。只有一张图时不会显示切换箭头。
            field:
              label: 图片
              name: image
              widget: image
              hint: 上传新图片时会自动启用 16:7 首页横幅裁剪框，可拖动选择保留区域；保存为最大 2560 × 1120 的 WebP。
              media_library:
                config:
                  crop_ratio: 2.285714
                  crop_label: 首页横幅 16:7
                  max_width: 2560
                  quality: 90
          - label: 页脚背景图
            name: footer
            widget: image
            required: false
            hint: 页脚会随屏幕宽度自动覆盖显示；上传时默认采用适合桌面端的 16:5 宽幅比例，保存为最大 1920 × 600 的 WebP。
            media_library:
              config:
                crop_ratio: 3.2
                crop_label: 页脚宽幅 16:5
                max_width: 1920
                quality: 90

  # =====================================================
  # 相册
  # =====================================================
  - name: gallery
    label: 相册
    label_singular: 照片
    description: 管理「相册」页展示的照片与描述，可上传新照片。
    media_folder: "/images/gallery"
    public_folder: "images/gallery"
    files:
      - name: gallery
        label: 相册照片
        file: _data/gallery.yaml
        fields:
          - label: 照片
            name: photos
            widget: list
            summary: "{{fields.image}}"
            fields:
              - label: 图片
                name: image
                widget: image
                required: false
                hint: 相册列表和点开后的大图共用同一张高清 WebP；上传时默认锁定原图比例，可拖动选择保留区域，最大宽度 2400px。
                media_library:
                  config:
                    crop_ratio: original
                    crop_label: 相册原图比例
                    max_width: 2400
                    quality: 100
              - label: 描述
                name: caption
                widget: object
                required: false
                fields:
                  - {label: 中文, name: zh, widget: string, required: false}
                  - {label: English, name: en, widget: string, required: false}

  # =====================================================
  # 招生招聘（加入我们）
  # =====================================================
  - name: join
    label: 招生招聘
    label_singular: 栏目
    description: 编辑「加入我们」页面的招聘与招生信息，分为博士后/科研助理、博士生、硕士生、本科生四个栏目。
    files:
      - name: join
        label: 招生招聘信息
        file: _data/join.yaml
        fields:
          - label: 栏目
            name: sections
            widget: list
            summary: "{{fields.title.zh}}"
            fields:
              - label: 标题
                name: title
                widget: object
                fields:
                  - {label: 中文, name: zh, widget: string}
                  - {label: English, name: en, widget: string}
              - label: 内容（支持 Markdown 语法）
                name: content
                widget: object
                fields:
                  - {label: 中文内容, name: zh, widget: markdown}
                  - {label: English content, name: en, widget: markdown}
