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

How to pass options? #80

Closed
mvsoom opened this issue Dec 29, 2024 · 3 comments
Closed

How to pass options? #80

mvsoom opened this issue Dec 29, 2024 · 3 comments

Comments

@mvsoom
Copy link

mvsoom commented Dec 29, 2024

Using version: 0.17.3.

I am trying to set the base path to / such that the Markdown content in src/content/vault all just map to mysite.com/[...slug] instead of mysite.com/vault/[...slug]. Per my understanding this can be achieved by just setting collectionBase: false. But I can't seem to get the plugin to read my options, even when passing invalid names and values for the Options type.

Here is my astro.config.mjsfile:

// @ts-check
import { defineConfig } from "astro/config";
import rehypeAstroRelativeMarkdownLinks from "astro-rehype-relative-markdown-links";

// https://astro.build/config
export default defineConfig({
  integrations: [],
  markdown: {
    rehypePlugins: [
      [
        rehypeAstroRelativeMarkdownLinks,
        {
          collectionBase: false,
        },
      ],
    ],
  },
  experimental: {
    svg: true,
  },
});

What am I doing wrong? I even tried changing the plugin code directly, but it does not seem to do anything. FYI I am a JS newbie.

@techfg
Copy link
Contributor

techfg commented Jan 2, 2025

@mvsoom -

Sorry to hear you are having difficulty. Your configuration appears to be accurate and should result in hrefs resolving to the site root. There are some issues with Astro v5 depending on your configuration which may be the cause although if your content lives in src/content/value that should not be the case.

Unfortunately, its unclear from your description how you are detecting that the hrefs are not transforming correctly so there isn't much to go on to determine where any potential problem might be occuring.

  1. Please update to the latest version v0.18.1 - While this should not make any difference from v0.17.3, this will ensure you have the latest version
  2. Please provide specific details on what you are seeing that leads you to believe things are not working as expected
  3. What version of Astro are you using?
  4. Please provide a repro via stackblitz (or similar) that demonstrates the issue

Thank you!

@mvsoom
Copy link
Author

mvsoom commented Jan 5, 2025 via email

@mvsoom mvsoom closed this as completed Jan 5, 2025
@techfg
Copy link
Contributor

techfg commented Jan 5, 2025

Thanks for the update @mvsoom and glad to hear it is working.

Assuming you were already on Astro v5 (and just updated to latest of v5), the underlying issue you were having is likely due to issues within Astro itself which was causing content collections to not be regenerated properly which means the plugin wasn't being re-executed and/or not at all depending on how you were building/running things. There's no way to know for sure, this is just speculation.

For anyone else that might be having issues with Astro v5, make sure you are running astro sync and npm run dev -- --force if you encounter odd/strange issues.

There are a few issues filed in Astro that should help solve the underlying problems.

  1. RenderUndefinedEntryError error when editing config with the --force content layer flag withastro/astro#12456 - Pending
  2. RenderUndefinedEntryError from dev server withastro/astro#12773 - Fix merged but not released yet
  3. Empty content collection when dev is first run withastro/astro#12866 - Fix merged but not released yet

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

No branches or pull requests

2 participants