zankhq / astro-starter

Astro starter template
https://astrostarter.zank.studio
MIT License
58 stars 11 forks source link

Error when changing .md file format to .mdx #14

Closed deployn closed 11 months ago

deployn commented 11 months ago

I encountered an error when attempting to change the file format of a blog post from .md to .mdx. The error message displayed is

Expected ";" but found ":"

Steps to reproduce:

  1. Change the file extension of the .md file to .mdx.
  2. Save the changes.

Expected behavior: The blog post should be visible without any errors.

Actual behavior: An error message is displayed, indicating that an unexpected character was found.

Error message: Expected ";" but found ":"

Edit: Additional Information: Testet on Windows and macOS with pnpm and npm.

zanhk commented 11 months ago

Hi @deployn thanks for the segnalation, I will be able to take a look on sunday

zanhk commented 11 months ago

@deployn I was not able to find the problem quickly, this coming week I will make a minimal demo to check if I can find the problem, could be a conflict with some other integration or some bug in astro. I will keep you updated

deployn commented 11 months ago

Thank you @zanhk for the update. I reconstructed the project and it seems that the source of the error might be related to NetlifyCMS.

zanhk commented 11 months ago

@deployn I m actually migrating away from NetlifyCMS in favor of https://github.com/majesticostudio/astro-sveltia-cms, I ll update you when finished so maybe it will fix this error as well

zanhk commented 11 months ago

@deployn The problem should be fixed, can you confirm?

deployn commented 11 months ago

Can confirm. In the meantime I used this CMS myself and had to edit the config.yml:

collections:
    - name: "mdx posts"
      i18n: true
      extension: "mdx"
      format: "frontmatter"
      label: "Blog Posts MDX"
      folder: "src/content/blog"
      create: true
      delete: true
      fields:
          - { name: "title", widget: "string", label: "Post Title", i18n: true }
          - { label: "Description", name: "description", widget: "string", i18n: true }
          - { label: "Publish Date", name: "pubDate", widget: "datetime", format: "YYYY-MM-DD HH:mm", i18n: "duplicate" }
          - { label: "Image", name: "heroImage", widget: "image", i18n: "duplicate" }
          - { name: "body", widget: "markdown", label: "Post Body", i18n: true }
    - name: "md posts"
      i18n: true
      label: "Blog Posts"
      folder: "src/content/blog"
      create: true
      delete: true
      fields:
          - { name: "title", widget: "string", label: "Post Title", i18n: true }
          - { label: "Description", name: "description", widget: "string", i18n: true }
          - { label: "Publish Date", name: "pubDate", widget: "datetime", format: "YYYY-MM-DD HH:mm", i18n: "duplicate" }
          - { label: "Image", name: "heroImage", widget: "image", i18n: "duplicate" }
          - { name: "body", widget: "markdown", label: "Post Body", i18n: true }

This way I could also edit mdx blog posts.