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

Issue: Incorrect path saved in front matter image field by image selector #755

Open
tohagan opened this issue Feb 15, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@tohagan
Copy link

tohagan commented Feb 15, 2024

Describe the bug

Image selector is saving the wrong path for Astro.

To Reproduce

Steps to reproduce the behavior:

  1. Configure frontmatter.json to contain the following:
 ...
  "frontMatter.content.pageFolders": [
    {
      "title": "posts",
      "path": "[[workspace]]/src/content/posts/en",
      "contentTypes": [
        "post"
      ]
    }
  ],
  "frontMatter.content.publicFolder": {
    "path": "src/assets",
    "relative": true
  },
  "frontMatter.taxonomy.contentTypes": [
   ...
      {
        "title": "Image",
        "name": "Image",
        "type": "image",
        "isPreviewImage": true
      },
  ]
...
  1. Edit a Markdown document
  2. Select an image from the src/assets directory

Expected Behavior

The correct image is displayed in the field but the path saved in the image field is ../../../assets/image.jpg instead of the expected src/assets/image.jpg.

Desktop (please complete the following information):

Windows 10

Possible Cause

This might be related in some way to the fact that I have to select the English subfolder "[[workspace]]/src/content/posts/en",

@tohagan tohagan added the bug Something isn't working label Feb 15, 2024
@estruyf
Copy link
Owner

estruyf commented Feb 15, 2024

There is nothing wrong with the path as this is how it needs to be for Astro:

<!-- Local image stored in src/assets/ -->
<!-- Use a relative file path or import alias -->
![A starry night sky.](../assets/stars.png)

<!-- Image stored in public/images/ -->
<!-- Use the file path relative to public/ -->
![A starry night sky.](/images/stars.png)

<!-- Remote image on another server -->
<!-- Use the full URL of the image -->
![Astro](https://example.com/images/remote-image.png)

Source: https://docs.astro.build/en/guides/images/#images-in-markdown-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants