Draft blog posts are published and listed in the sitemap
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Read apps/outreach/src/pages/[locale]/blog/[slug].astro and compare its getStaticPaths collection query with the filter in apps/outreach/src/pages/[locale]/blog/index.astro. Run pnpm --filter @opendatacapture/outreach build; done means the draft's page is absent from dist and its URL is absent from dist/sitemap-0.xml.
Written by the indexing model from the issue text.
Description
Blog posts marked isDraft: true are still published. The blog index filters drafts out, but the post route's getStaticPaths builds a page for every entry in the blog collection, drafts included. The draft is then live at its URL, and @astrojs/sitemap lists it in sitemap-0.xml, so search engines are told to index it. Today this exposes blog/open-data-capture-vs-redcap.md (isDraft: true), which is served at https://opendatacapture.org/en/blog/open-data-capture-vs-redcap/ with a 200.
Where
apps/outreach/src/pages/[locale]/blog/[slug].astro:11-23:
export const getStaticPaths = async () => {
const posts = await getCollection('blog');
const paths = posts.map((post) => ({
params: {
locale: post.data.language,
slug: post.slug
},
props: { post }
}));
The index applies the filter the post route is missing, at apps/outreach/src/pages/[locale]/blog/index.astro:17:
const posts = await getCollection('blog', ({ data }) => data.language === resolvedLanguage && !data.isDraft);
Reproduce
pnpm --filter @opendatacapture/outreach build.- Look for
dist/en/blog/open-data-capture-vs-redcap/index.html, and grepdist/sitemap-0.xmlforopen-data-capture-vs-redcap.
Actual: the page is built, and the sitemap lists https://opendatacapture.org/en/blog/open-data-capture-vs-redcap/. The live site serves it.
Expected: no page and no sitemap entry for a post with isDraft: true.
Tests
apps/outreach has no unit or Playwright suite, by decision (apps/outreach/AGENTS.md). Verify through the build: after the fix, dist/en/blog/open-data-capture-vs-redcap/ does not exist and dist/sitemap-0.xml does not mention it.
Suggested fix
Filter with the same predicate in getStaticPaths: getCollection('blog', ({ data }) => !data.isDraft).
- Dominant language
- TypeScript
- Stars
- 119
- Forks
- 19
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 56
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DouglasNeuroInformatics/OpenDataCapture
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
Maintainers usually reply within 1 day
All issues in DouglasNeuroInformatics/OpenDataCapture
Similar issues
-
[Feature]: [P3] engine-rs: the package source hash should ignore line endings and untracked filesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
maniator/verticopolis#880 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
siyuan-note/siyuan#20353 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
black-forest-labs/skills#17 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Albert-Weasker/niubigeo#168 ·
Maintainers usually reply within 1 day