The-DevOps-Daily / The-DevOps-Daily/devops-daily
feat: Add canonical URL audit and consistency check
Open
Nobody has claimed this yet.
enhancement
good first issue
hacktoberfest
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 392
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 121
Description
Description
Audit all pages for proper canonical URL tags and ensure consistency across the site to prevent duplicate content SEO issues.
Problem
- Canonical URLs may not be set on all pages
- Risk of duplicate content penalties
- Inconsistent URL patterns across site
- No automated verification of canonical tags
SEO Impact
- Search engines may index wrong version of pages
- Duplicate content dilutes page authority
- Could affect search rankings
- Wasted crawl budget
Pages to Audit
Content Pages
- Posts:
/posts/[slug] - Guides:
/guides/[slug]and/guides/[slug]/[part] - Quizzes:
/quizzes/[slug] - Games:
/games/[slug] - News:
/news/[slug] - Exercises:
/exercises/[id]
Listing Pages
- Homepage:
/ - Posts index:
/posts - Guides index:
/guides - Quizzes index:
/quizzes - Games index:
/games - Tags:
/tags/[tag] - Categories:
/categories/[slug] - Authors:
/authors/[slug]
Paginated Pages
- Check if pagination exists
- Ensure proper canonical for paginated results
Current State Check
# Search for canonical tags
rg '<link rel="canonical"' app/
# Check metadata generation
cat app/*/page.tsx | grep canonical
Proposed Solution
- Audit existing canonical tags
- Add canonical to all page metadata
- Create utility function for canonical URLs
- Add automated tests
Implementation Example
// lib/canonical.ts
export function getCanonicalUrl(path: string): string {
const baseUrl = 'https://devops-daily.com';
return `${baseUrl}${path}`;
}
// In page.tsx
export const metadata: Metadata = {
title: 'Post Title',
alternates: {
canonical: getCanonicalUrl('/posts/my-post')
}
};
Acceptance Criteria
- Audit all pages for canonical tags
- Create canonical URL utility function
- Add canonical to all page metadata
- Ensure consistent URL patterns (trailing slashes, etc.)
- Add automated test for canonical tags
- Verify in production with view-source
- Add to SEO checklist
- Document canonical URL conventions
Testing
// tests/canonical-urls.test.ts
import { describe, it, expect } from 'vitest';
import { getCanonicalUrl } from '@/lib/canonical';
describe('Canonical URLs', () => {
it('generates correct canonical URL', () => {
expect(getCanonicalUrl('/posts/test')).toBe(
'https://devops-daily.com/posts/test'
);
});
it('handles trailing slashes', () => {
expect(getCanonicalUrl('/posts/test/')).toBe(
'https://devops-daily.com/posts/test'
);
});
});
Files to Create/Modify
lib/canonical.ts- New utilitytests/canonical-urls.test.ts- New tests- All
page.tsxfiles - Add canonical metadata docs/seo.md- Document canonical URL strategy
Contributor 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.
Research direction
Start by running the provided ripgrep search in app/ and inspecting the page.tsx metadata entries. Review the proposed lib/canonical.ts and tests/canonical-urls.test.ts alongside the listed content, listing, and paginated routes. Done means canonical metadata is consistent across the pages, the utility and automated tests exist, and docs/seo.md records the convention.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100