Hide draft blog posts from listings, feeds, and search#3065
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes
draft: truein a blog post's frontmatter hide the post everywhere except its own direct URL.A draft post:
/blog/post/<slug>(renders normally)/blog/rss.xml), the JSON feed (/blog/feed.json), andllms.txt/llms-full.txt<meta name="robots" content="noindex">so search engines drop it while the URL stays liveHow
A single source of truth: a new
publishedPosts(non-draft) export inblog/content.ts, reused by:getBlogEntries()for the listing and category chipsrss.xml,feed.json)llmsgenerators (matched by slug)Post.sveltegains adraftprop and the conditionalnoindexmeta. The post route itself is untouched, so the URL keeps working.unlistedbehavior is unchanged.Testing
svelte-check: 0 errors, 0 warningsnoindex; published posts are unaffectedCall-outs (not included here)
server/sitemap.js) builds from the route manifest, not frontmatter, so a draft URL can still appear insitemap.xml.noindexstill prevents indexing; excluding it from the sitemap would be a small follow-up.