The-DevOps-Daily / The-DevOps-Daily/devops-daily

feat: Add canonical URL audit and consistency check

Open
#545 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Audit existing canonical tags
  2. Add canonical to all page metadata
  3. Create utility function for canonical URLs
  4. 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 utility
  • tests/canonical-urls.test.ts - New tests
  • All page.tsx files - Add canonical metadata
  • docs/seo.md - Document canonical URL strategy

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.