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

feat: Render titles for social sharing and improve home page sharing #263

Merged
merged 1 commit into from
May 27, 2021

Conversation

ElMassimo
Copy link
Contributor

@ElMassimo ElMassimo commented Mar 18, 2021

Description 📖

This pull request improves social sharing for all Vitepress websites by rendering og:title and twitter:title meta tags based on the individual page title.

These meta tags are only added if they weren't already provided by the user.

Notes ✏️

Home | is intentionally avoided as the website title looks nicer on its own when sharing a website.

This is only changed in the rendered HTML, the dynamic title will still include Home |, as it looks fine when a user is already on the site.

Background 📜

Since the title is different for every page, rendering these meta tags would require adding a Vue component, that duplicates the logic in render.ts to obtain the full title.

By rendering these tags using the title, sharing a specific page in a tweet or similar social websites will display a card with the correct title.

@antfu antfu merged commit e651f97 into vuejs:master May 27, 2021
@ElMassimo ElMassimo deleted the social-title branch May 27, 2021 12:59
YunYouJun pushed a commit to YunYouJun/vitepress that referenced this pull request Aug 30, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants