Skip to content

baseURL for assets referred in frontmatter #2055

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

Open
kermanx opened this issue Feb 6, 2025 · 2 comments
Open

baseURL for assets referred in frontmatter #2055

kermanx opened this issue Feb 6, 2025 · 2 comments

Comments

@kermanx
Copy link
Member

kermanx commented Feb 6, 2025

Assets paths in frontmatter won't be resolved by Vite, thus they will be broken once baseURL changes.

However, there is no way to automatically detect whether a string in the frontmatter is a path or not.

We may need a placeholder for base URLs. For example:

---
background: ${BASE_URL}/image.png
# Or ${BASE_URL}image.png because BASE_URL by Vite's definition starts and ends with a slash
---

Ref #2005 (comment)

@jmuchovej
Copy link

so, it's possible that ${BASE_URL} would work, but the FAQs on asset handling seems to point to frontmatter will resolve correctly post-build? https://sli.dev/guide/faq#assets-handling

maybe i'm misunderstanding, but i also know that a wrench i threw into the mix as a non-standard kind of asset (.bib and .csl – which are almost exclusively academically used assets).

@lishaduck
Copy link

I found that it worked for favicon: /favicon.png, but not for background, which needed background: ./cover.jpg.

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

3 participants