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

API to change head content #551

Closed
4 tasks done
aboutsimon opened this issue Feb 22, 2022 · 2 comments
Closed
4 tasks done

API to change head content #551

aboutsimon opened this issue Feb 22, 2022 · 2 comments
Labels
build Related to the build system enhancement New feature or request theme Related to the theme

Comments

@aboutsimon
Copy link

aboutsimon commented Feb 22, 2022

Is your feature request related to a problem? Please describe.

Currently, there is no documented way to programmatically change or add head tags to the page at build time, that i'm aware of. I know that i can add head tags in the config or via frontmatter, but in some cases that is not sufficient. For example, when i want to add head tags based on existing meta data, like generating an og:image based on frontmatter (gatsby-remark-twitter-cards is an example in react land).

Describe the solution you'd like

A clean API to programmatically change or add head tags, prior to SSG.

Describe alternatives you've considered

Obviously i could dynamically add head tags to the page, but for some tags that is not a viable solution. For example, social media sites usually don't execute JS on the page, so any dynamically added Open Graph tags will not be considered.

Another option would be hacking something together around rollup's transform hook, but i would rather use a more dedicated vitepress API directly.

Additional context

Maybe i'm missing something here and this is already possible - then please point me in the right direction.

Validations

@jimbo2150
Copy link

The social media tags were added to Frontmatter for the VitePress website, but they don't appear to be applying (either on the VitePress site or mine) and don't appear to be documented. Is that a bug?

@kiaking kiaking removed this from the v1.0.0 milestone Jan 20, 2023
@brc-dd
Copy link
Member

brc-dd commented Mar 11, 2023

@brc-dd brc-dd closed this as completed Mar 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Related to the build system enhancement New feature or request theme Related to the theme
Projects
None yet
Development

No branches or pull requests

4 participants