[Bug]: Missing canonical tags on docs pages and blog posts
- Dominant language
- TypeScript
- Stars
- 716
- Forks
- 1.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 35
Description
## Problem
Canonical tags are missing from the `` section of documentation pages and blog posts. This impacts SEO and can lead to duplicate content issues.
## Current Behavior
- **Docs pages**: No canonical tag is present in the page source
- **Blog posts**: Canonical tags are only added conditionally when `post.canonical` exists in frontmatter, but many posts don't have this field set
## Expected Behavior
All pages should have a canonical tag in the `` section:
- Docs pages should automatically use the current page URL as the canonical URL
- Blog posts should use a custom canonical URL if specified in frontmatter, otherwise default to the current page URL
## Impact
- **SEO**: Search engines may not understand which URL is the preferred version of the content
- **Duplicate Content**: Without canonical tags, search engines might index multiple URLs for the same content
- **Link Equity**: Page authority may be split across duplicate URLs
## Evidence
### 1: Missing canonical on docs page
- Navigate to: https://www.asyncapi.com/docs/concepts/asyncapi-document
- View page source
- Search for "canonical" (no results found)
- The `` section does not contain a canonical tag
### 2: Inconsistent canonical on blog posts
- Some blog posts have canonical tags (only if `canonical` field exists in frontmatter)
- Many blog posts are missing canonical tags when the frontmatter doesn't include this field
- This creates inconsistent SEO implementation across blog content
## Solution
The `Head` component should:
1. Always include a canonical tag using the current page URL as default
2. Accept an optional `canonical` prop to override the default URL
3. Be used consistently across all page types (docs, blog, etc.)
## Related Files
- `components/Head.tsx` - Main head component that needs canonical tag support
- `components/layout/DocsLayout.tsx` - Docs layout using Head component
- `components/layout/BlogLayout.tsx` - Blog layout that conditionally adds canonical tags
Contributor guide
Research direction
Start in components/Head.tsx, then trace its use from components/layout/DocsLayout.tsx and components/layout/BlogLayout.tsx. Verify the current page URL and the optional post.canonical behavior, then check page source for both docs and blog pages. Done means every page has a canonical tag, with frontmatter overriding the blog default when specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, react, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100