SEO
SEO Improvements - Canonical URL Standardization¶
This document outlines changes made to standardize canonical URLs across the documentation site, addressing "Alternate page with proper canonical tag" issues reported by Google.
Problem Addressed¶
Google reported multiple URLs for the same content (e.g., www.e-pragma.gr, docs.e-pragma.gr, e-pragma.gr, and variations with index.html or ?q parameters) leading to indexing inefficiencies due to inconsistent canonical tags.
Solution Implemented¶
To ensure a single, consistent canonical URL (https://www.e-pragma.gr) for all pages, the following modifications were made:
-
mkdocs.ymlConfiguration:- Confirmed
site_url: "https://www.e-pragma.gr"is correctly set, defining the primary domain for the site.
- Confirmed
-
material/overrides/base.htmlModification:- The
<link rel="canonical">tag was updated to actively enforcehttps://www.e-pragma.gras the canonical domain. This was achieved by modifying the Jinja2replacefilter:http://0.0.0.0:8000/SEO/
- This ensures that any automatically generated canonical URLs incorrectly containing
docs.e-pragma.grore-pragma.grare corrected towww.e-pragma.gr.
- The
-
sitemap.xmlFiles Modification (material/overrides/sitemap.xmlanddocs/sitemap.xml):- Both custom sitemap template files were updated with similar
replacefilters forfile.page.canonical_urlandfile.page.abs_url. - This guarantees that all URLs listed within the generated sitemaps also consistently point to
https://www.e-pragma.gr, further reinforcing the intended canonical domain for search engines.
- Both custom sitemap template files were updated with similar
Expected Outcome¶
These changes provide a clear and consistent signal to search engines regarding the preferred version of each page. Over time, this should lead to: * Improved indexing efficiency. * Better search ranking signals consolidated to the canonical https://www.e-pragma.gr URLs. * Reduction in "Alternate page with proper canonical tag" warnings in Google Search Console.
Further Considerations (External to MkDocs Configuration)¶
While these changes address the canonicalization within the MkDocs build process, persistent issues with index.html suffixes or ?q parameters in Google's reports may require further investigation into: * Web Server Configuration: Ensuring proper 301 redirects are in place for docs.e-pragma.gr and e-pragma.gr to www.e-pragma.gr, and for */index.html to */. * Internal Linking: Reviewing any hardcoded internal links that might still point to non-canonical URLs. * External Backlinks: Identifying and (if possible) updating external backlinks that point to non-canonical URLs.