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

public_folder forces leading / #2238

Closed
Larsklopstra opened this issue Mar 23, 2019 · 5 comments
Closed

public_folder forces leading / #2238

Larsklopstra opened this issue Mar 23, 2019 · 5 comments

Comments

@Larsklopstra
Copy link

Describe the bug
Using public_folder: "../uploads" I'd assume it would return ../uploads/image.png but the result is ./../uploads/image.png thus resulting in a 404.

The forced leading slash will prevent Gridsome from optimizing the images.

Expected behavior
Using public_folder: "../uploads" should return ../uploads/image.png NOT ./../uploads/image.png.

CMS configuration

backend:
  name: github
  repo: Larsklopstra/gridsome-starter-netlify-cms

media_folder: "uploads"
public_folder: "../uploads"

collections:
  - name: "posts"
    label: "Posts"
    folder: "posts"
    create: true
    slug: "{{slug}}"
    fields:
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Excerpt", name: "excerpt", widget: "string"}
      - {label: "Body", name: "body", widget: "markdown"}

Additional context
Using Gridsome as static site generator.

@tomrutgers
Copy link
Contributor

tomrutgers commented Mar 23, 2019

I'm not exactly a gridsome expert, but I'm pretty sure the paths in your config need to be absolute. Pretty sure you don't want them to be in root either. So something like:

media_folder: "static/uploads/"
public_folder: "/uploads/

@Larsklopstra
Copy link
Author

@tomrutgers I want to avoid placing files into the static folder, if I change the article-example.md its contents from ![](/../image.png) to ![](../image.png) then it will work perfectly, so the issue is the forced leading slash. I've tried many different configs.

@erquhart
Copy link
Contributor

erquhart commented Apr 2, 2019

Related to #325 and #1668.

@stale
Copy link

stale bot commented Oct 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@erquhart
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants