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(core): siteConfig.headTags API to render extra tags in document head #8151

Merged
merged 6 commits into from
Oct 12, 2022
Merged

feat(core): siteConfig.headTags API to render extra tags in document head #8151

merged 6 commits into from
Oct 12, 2022

Conversation

johnnyreilly
Copy link
Contributor

@johnnyreilly johnnyreilly commented Sep 30, 2022

Pre-flight checklist

Motivation

This is a follow on of #8077 - motivation copied from there:

I'm trying to add a custom link tag to the header of all the pages on my Docusaurus site. In my case I'm looking to render a web monetization link which looks like this:

<link rel="monetization" content="https://ilp.uphold.com/LwQQhXdpwxeJ" />

It looks like there isn't a way to generically supply global link tags with Docusaurus. At least... until now!

Test Plan

Herewith a screenshot of the new documentation and the rendered link tag:

image

There's a failing "Build Performance" test - it doesn't seem to be related to the changes in this PR; I'm guessing this is a flaky test. No issues building locally.

Test links

Deploy preview: https://deploy-preview-8151--docusaurus-2.netlify.app/docs/api/docusaurus-config#headTags

Crack open the devtools and you can see the link tag present and correct. You may well want to replace this link tag with your own!

Related issues/PRs

#8077
#8049

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Sep 30, 2022
@johnnyreilly johnnyreilly mentioned this pull request Sep 30, 2022
3 tasks
@netlify
Copy link

netlify bot commented Sep 30, 2022

[V2]

Name Link
🔨 Latest commit f7f444f
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6346dd3b4fb345000980b461
😎 Deploy Preview https://deploy-preview-8151--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Sep 30, 2022

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 64 🟢 98 🟢 100 🟢 100 🟠 80 Report
/docs/installation 🟢 90 🟢 100 🟢 100 🟢 100 🟢 90 Report

@johnnyreilly
Copy link
Contributor Author

Pretty sure build performance test will pass if you rerun it - not sure what happened there. Nothing significant should have changed with this PR - no segfaults received when building on my old local machine 😅

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks like the API I want 👍

config.headTags or config.head, not sure what is best. Not a big deal, we can change later if we want.

I'd rather remove any ref to the WIP monetization API for now and use a simpler example

Also good to have more validation tests

website/docusaurus.config.js Outdated Show resolved Hide resolved
website/docs/api/docusaurus.config.js.md Outdated Show resolved Hide resolved
packages/docusaurus/src/server/configValidation.ts Outdated Show resolved Hide resolved
@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Oct 7, 2022
@johnnyreilly
Copy link
Contributor Author

I think that's the feedback addressed!

@johnnyreilly
Copy link
Contributor Author

Does this look okay @slorber ?

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Will do the cleanup and merge 👍

website/docusaurus.config.js Outdated Show resolved Hide resolved
@johnnyreilly
Copy link
Contributor Author

Awesome!

@slorber slorber changed the title feat: headTags API for tags rendered in the head feat(core): siteConfig.headTags API to render extra tags in document head Oct 12, 2022
@slorber slorber added the to backport This PR is planned to be backported to a stable version of Docusaurus label Oct 12, 2022
@slorber slorber merged commit 1ca4fb5 into facebook:main Oct 12, 2022
johnnyreilly added a commit to johnnyreilly/blog.johnnyreilly.com that referenced this pull request Oct 20, 2022
slorber added a commit that referenced this pull request Oct 28, 2022
…head (#8151)

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
@slorber slorber added backported This PR has been backported to a stable version of Docusaurus and removed to backport This PR is planned to be backported to a stable version of Docusaurus labels Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported This PR has been backported to a stable version of Docusaurus CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make stylesheets API more generalized
3 participants