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

Changing path doesn't change file/folders to reflect new path #4542

Closed
stevemarksd opened this issue Nov 8, 2020 · 1 comment
Closed

Changing path doesn't change file/folders to reflect new path #4542

stevemarksd opened this issue Nov 8, 2020 · 1 comment
Labels
type: bug code to address defects in shipped code

Comments

@stevemarksd
Copy link

stevemarksd commented Nov 8, 2020

Describe the bug
If you look at my config below I have


        path: '{{path}}/{{path}}'
        preview_path: '{{path}}'

So it saves the article this way:

  • slug
    • slug.md
    • images.jpg

To Reproduce

Add my settings.

Then create a new post. path: slug1

  • slug1
    • slug1.md
    • images.jpg

Change path to slug 2

File and folder is still named under previous name.

  • slug1
    • slug1.md
    • images.jpg

Expected behavior

  • slug2
    • slug2.md
    • images.jpg

Also branch name is still slug1 instead of slug2

Screenshots

Applicable Versions:

  • Netlify CMS version: "netlify-cms-app": "2.13.1",
  • Git provider: gitlab (AWS lightsail bitnami)

CMS configuration

# https://www.netlifycms.org/docs/gitlab-backend/
backend:
  name: gitlab
  repo: root/site.com
  branch: master
  api_root: https://mygitlab.com/api/v4
  base_url: https://mygitlab.com/
  auth_type: implicit
  app_id: 222
  auth_endpoint: oauth/authorize
# Where to save image
media_folder: src/content/images/cms
# Prefix image url (gatsby-remark-relative-images staticFolderName + media_folder = image)
public_folder: /images/cms
publish_mode: editorial_workflow
collections:
  - name: default
    label: Default
    folder: src/content/pages
    create: true
    media_folder: ''
    public_folder: ''
    path: '{{path}}/{{path}}'
    preview_path: '{{path}}'
    fields:
      - { name: path, label: Path, widget: 'string' }
      - { name: createdAt, label: Created Date, widget: 'datetime' }
      - { name: updatedAt, label: Last Updated Date, widget: 'datetime' }
      - { name: title, label: Title, widget: 'string' }
      - { name: description, label: Description, widget: 'string' }
      - { name: keywords, label: Keywords, widget: 'string' }
      - { name: tags, label: Tags, widget: 'list' }
      - { name: featuredImage, label: Featured Image, widget: 'image' }
      - { name: content, label: Show on home page, widget: 'boolean', default: true }
      - { name: body, label: Body, widget: 'markdown' }

Note the path: '{{path}}/{{path}}'. This will create pr with the name /slug1/slug1/, maybe having that slash breaks? but sometimes works... so should be something else.

Additional context

@stevemarksd stevemarksd added the type: bug code to address defects in shipped code label Nov 8, 2020
@stevemarksd stevemarksd changed the title Changing path doesn't change file/folders to reflect Changing path doesn't change file/folders to reflect new path Nov 8, 2020
@erezrokah
Copy link
Contributor

Hi @stevemarksd, this is intended as changing the file path will most likely break existing published URLs in static site generators.

This is discussed in #445. Closing this issue in favour of #445

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