feat(docs,blog,pages): add support for "unlisted" front matter - hide md content in production#8004
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
be36a4b to
760dca9
Compare
slorber
left a comment
There was a problem hiding this comment.
Thanks! Looks like a very good start 👏
See my comments, will review the rest in 2+ weeks after my holiday ;)
packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/globalData.test.ts.snap
Outdated
Show resolved
Hide resolved
packages/docusaurus-plugin-content-blog/src/__tests__/__snapshots__/feed.test.ts.snap
Outdated
Show resolved
Hide resolved
|
@jodyheavener do you want to do some edits? Otherwise I'll try to complete and merge it |
# Conflicts: # website/_dogfooding/_pages tests/index.md
|
🤯 this feature is full of little edge cases to consider. Still WIP, but it's progressing. I created a better docs dogfood dataset here, and it works nicely: There are some yet-to-be-resolved comments above, and notable the handling of tags pages and paginated lists. Will try to complete all this next week |
slorber
left a comment
There was a problem hiding this comment.
PR is good to merge 👍
I'll check 1 or 2 edge cases I'm thinking about tomorrow but otherwise it's complete
Note: it's a lot of code, I won't backport it in 2.x and we'll ship it in 3.0
|
PR is good to merge! That wasn't an easy one 🤪 tons of little edge cases to consider. |
|
Thanks for this great new feature! Are there any plans for a release soon? |
|
Not planned to be backported in 2.x and 3.x is not so close yet so if you need it you need to use a canary release (it's quite stable, that's fine) |
PR started by @jodyheavener , finalized by @slorber
Motivation
Add uniform support for
unlisted: truefront matter to all 3 content plugins.Unlike
draft: true, unlisted content is accessible in production.The goal is to give the ability to publish content in production but keep it "secret" until it's time to market it (like a new release blog post...). Being accessible in production build makes it easier to share a secret link to co-workers and ask for a review. The content will also be accessible in deploy previews that (unlike drafts).
Unlisted means that a Markdown file will be:
docusaurus start)docusaurus build), but still available.Unlisted items are "hidden" in production in multiple ways:
<meta name="robots" content="noindex, nofollow" />metadataThis PR also adds the missing
draft: truesupport for the content pages plugin.This PR is quite significant, won't be backported
Unlisted pages have a banner displayed in production:
(we can probably improve this later, it probably makes sense for DX to also display such a banner in dev mode for both draft/unlisted => #8285)
Test Plan
I added multiple dogfood content to our own website.
It is possible to test the production mode locally faster with this secret env variable:
SIMULATE_PRODUCTION_VISIBILITY=true yarn start:websiteBlog
Blog tags
Docs
Docs tags
Docs category links:
Pages
Sitemap
Related issues/PRs
Closes #5701