The-DevOps-Daily/devops-daily
View on GitHubfeat: Add canonical URL audit and consistency check
Open
#545 opened on Dec 2, 2025
enhancementgood first issuehacktoberfest
Repository metrics
- Stars
- (1,087 stars)
- PR merge metrics
- (Avg merge 1d 23h) (82 merged PRs in 30d)
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