Skip to content

Mismatch between repo path and collection folder when deploying from a monorepo #7598

@tpluscode

Description

@tpluscode

I think I'm looking for some concept like a "root dir".

In my setup, I have a nuxt app which serves decap and render's its content. The thing is, the app is in a subdirectory in my repository and the entire thing is a monorepo. It looks something like

/
└── nuxt-app/
    └── content/
        ├── blog
        ├── handbook
        └── pages

In my config, I have these collections to match

backend:
  name: github

collections:
  - name: handbook
    label: "Handbook articles"
    label_singular: Handbook article
    identifier_field: id
    folder: "content/handbook"
    extension: md
    widget: "list"
    create: true
    i18n: true
    summary: "{{title}}"
    view_groups:
      - label: Section
        field: section
    path: '{{section}}/{{slug}}'
    fields: []

  - name: pages
    label: "Pages"
    folder: "content/pages"
    extension: md
    widget: "list"
    create: false
    i18n: true
    fields: []

  - name: blog
    label: Blog
    label_singular: Blog Post
    folder: "content/blog"
    extension: md
    widget: "list"
    create: true
    i18n: true
    fields: []

See that each collection's folder is content/*, which works when I add local_backend: true. But when I run the deployed app, I assume decap is looking for content/blog, etc in the root of the repository.

I see a number of possible solutions but none that exist

  1. Add an option to local_backend

    local_backend:
      root: nuxt-app
    
    collections:
       - name: blog:
         folder: nuxt-app/content/blog

    This way, the folder must match the repo but local_backend removes it when serving local. Not super fond of this, as it appear a little unintuitive

  2. Add an option to github backend

    backend:
      name: github
      rootDir: nuxt-app
    
    collections:
       - name: blog:
         folder: content/blog

    A little better, keeps the relative path for folder options but the additional rootDir property of GH backend tells it look for content in the right subdirectory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurecode contributing to the implementation of a feature and/or user facing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions