Module: Seo::UrlNormalizer

Defined in:
app/lib/seo/url_normalizer.rb

Overview

Normalizes URLs for SEO tooling (GSC/Ahrefs imports, cannibalization display).
Google Search Console often reports the same logical page multiple times when
URLs include #fragment anchors; we treat those as one URL for comparisons.

Class Method Summary collapse

Class Method Details

.without_fragment(url) ⇒ Object



8
9
10
11
12
# File 'app/lib/seo/url_normalizer.rb', line 8

def self.without_fragment(url)
  return '' if url.blank?

  url.to_s.strip.split('#', 2).first.to_s
end