Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to use local_backend in a Hugo website #7030

Closed
alanlivio opened this issue Jan 11, 2024 · 2 comments
Closed

Not able to use local_backend in a Hugo website #7030

alanlivio opened this issue Jan 11, 2024 · 2 comments
Labels
type: bug code to address defects in shipped code

Comments

@alanlivio
Copy link

alanlivio commented Jan 11, 2024

Describe the bug

I want to use the Hugo website[1] with local_backend[2]. My problem is where I can put the config.yml.
The tutorial [1] says to put the config.yml at static/admin/config.yml while the tutorial[2] says to put it in the root.
I tried to follow [2] using relative paths but I received the error below.

[1] https://decapcms.org/docs/hugo/
[2] https://decapcms.org/docs/beta-features/#working-with-a-local-git-repository

To Reproduce

  1. git clone https://github.com/HugoBlox/theme-academic-cv
  2. cd theme-academic-cv
  3. git apply theme-academic-cv-decap-cms.patch # theme-academic-cv-decap-cms.patch
  4. hugo server
  5. cd static/admin && npx decap-server # at other shell

Expected behavior
Hugo app

Screenshots
Screenshot 2024-01-11 204432

Applicable Versions:

  • Decap CMS version: 3.0.0
  • Git provider: [GitHub]
  • Node.JS version: v20.11.0

CMS configuration

local_backend: true
backend:
  name: git-gateway
  branch: main
media_folder: ../../content/media
public_folder: /img
collections:
  - name: 'blog'
    label: 'Blog'
    folder: '../../content/post'
    create: true
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    editor:
      preview: false
    fields:
      - { label: 'Title', name: 'title', widget: 'string' }
      - { label: 'Publish Date', name: 'date', widget: 'datetime' }
      - { label: 'Description', name: 'description', widget: 'string' }
      - { label: 'Body', name: 'body', widget: 'markdown' }
@alanlivio alanlivio added the type: bug code to address defects in shipped code label Jan 11, 2024
@alanlivio
Copy link
Author

I was able to find a solution from the Hugo theme document I am using, called Hugo Blox [1]. See below how to do it.

Although I found the solution, maybe it is a good indication to update the document about the local git backend.
I suggest highlighting that the npx decap-server is independent of the config.yml location and should always run from the repository root.

[1] https://docs.hugoblox.com/getting-started/cms/decap/
[2] https://decapcms.org/docs/beta-features/#working-with-a-local-git-repository

To Reproduce

  1. git clone https://github.com/HugoBlox/theme-academic-cv
  2. cd theme-academic-cv
  3. git apply theme-academic-cv-decap-cms.patch # theme-academic-cv-decap-cms.patch
  4. hugo server
  5. npx decap-server # at other shell

CMS configuration at config/_default/params.yml

extensions:
  cms:
    branch: main
    publish_mode: editorial_workflow
    local_backend: true

@martinjagodic
Copy link
Member

Hi @alanlivio I understand that you found a solution, so I am closing the issue. It also seems that this is more of pa problem with the Hugo theme docs, not Decap docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants