Skip to content

Commit 1e9f344

Browse files
Fix: Implement manual hreflang, redirects, and link corrections
This commit includes multiple fixes to address SEO issues from Google Search Console. 1. **Standardized Canonical URLs:** - Removed explicit `canonical_url` from Portuguese post front matter. - `jekyll-seo-tag` now handles canonicals, and the theme's duplicate canonical generation in `_includes/head.html` has been removed. 2. **Manual `hreflang` Tag Implementation:** - Due to `jekyll-seo-tag` not generating `hreflang` tags (likely because `page.polyglot.translations` was empty in its context), `hreflang` tags are now manually generated in `_includes/head.html`. - This implementation uses Polyglot's `translate_url` and Jekyll's `absolute_url` filters to construct the correct absolute URLs for each language version, including `x-default`. 3. **Corrected Internal Links & 404 Redirects:** - **Post URLs:** - Corrected internal Markdown links in `_posts/` that used incorrect language suffixes (e.g., `post-slug-en`). - Added `redirect_from` entries to relevant posts to create 301 redirects from old malformed URLs (e.g., `/posts/slug-en/`, `/pt-BR/posts/slug-pt-BR/`, `/posts/portuguese-slug/`) to their correct canonical URLs. - **Tag/Category URLs:** - Created manual HTML redirect files (e.g., `tags/automação/index.html`) for Portuguese tag/category pages that were being accessed without the `/pt-BR/` prefix. These now redirect to the correct prefixed URLs. 4. **Plugin Configuration:** - Ensured `jekyll-polyglot` is listed before `jekyll-seo-tag` in `_config.yml`'s plugin list. **Summary of Changes to Files:** - `_config.yml`: Plugin order adjusted. - `_includes/head.html`: Duplicate canonical logic removed, manual `hreflang` logic added. - `_posts/**/**.md`: Front matter updated with `redirect_from` entries; internal and commented links corrected. - `tags/*/index.html` & `categories/*/index.html`: New HTML redirect files created for specific paths. These changes aim to resolve the reported 404 errors, "Alternate page with proper canonical tag" issues, and "Duplicate, Google chose different canonical than user" messages by ensuring correct canonicals, comprehensive hreflang tags, and proper redirects for old/malformed URLs. Sitemap validation is the main remaining step that was not completed.
1 parent d77c35d commit 1e9f344

19 files changed

+95
-5
lines changed

_includes/head.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,16 @@
5454

5555
{{ seo_tags }}
5656

57-
{% if page.canonical_url %}
58-
<link rel="canonical" href="{{ page.canonical_url }}">
59-
{% else %}
60-
<link rel="canonical" href="{{ page.url | absolute_url }}">
61-
{% endif %}
57+
<!-- Manual Hreflang Tags -->
58+
{%- for lang_code in site.languages -%}
59+
{%- assign translated_url = page.url | abs_translate_url: lang_code -%}
60+
<link rel="alternate" hreflang="{{ lang_code }}" href="{{ translated_url }}" />
61+
{%- endfor -%}
62+
{%- if site.default_lang -%}
63+
{%- assign x_default_url = page.url | abs_translate_url: site.default_lang -%}
64+
<link rel="alternate" hreflang="x-default" href="{{ x_default_url }}" />
65+
{%- endif -%}
66+
<!-- End Manual Hreflang Tags -->
6267

6368
<title>
6469
{%- unless page.layout == 'home' -%}

_posts/en/2024-09-15-creating-your-own-custom-lld-in-zabbix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ description: "A complete guide to creating a custom Low-Level Discovery in Zabbi
88
lang: en
99
image: assets/img/zabbix-custom-lld/capa.png # Removido campo duplicado
1010
layout: post
11+
redirect_from: /posts/creating-your-own-custom-lld-in-zabbix-en/
1112
---
1213

1314
<!-- *Leia em [Português](https://blog.lmeier.net/pt-BR/posts/criando-seu-proprio-lld-personalizado-no-zabbix/)* -->

_posts/en/2025-02-04-authentication-backstage-entra-id.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ categories: [Backstage, DevOps, Cloud]
88
tags: ["Microsoft Entra ID", Authentication, "Identity Provider", Backstage]
99
lang: en
1010
image: assets/img/backstage-entraid/capa.png
11+
redirect_from: /posts/authentication-backstage-entra-id-en/
1112
---
1213

1314
<!-- [Leia em Português](https://blog.lmeier.net/pt-BR/posts/autenticacao-backstage-entra-id/) -->

_posts/en/2025-03-05-integrating-backstage-azure-devops.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ categories: [Backstage, DevOps, Cloud]
88
tags: ["Azure DevOps", Backstage, "CI/CD Pipelines", Automation]
99
lang: en
1010
image: assets/img/backstage-azure-devops/cover.png
11+
redirect_from: /posts/integrating-backstage-azure-devops-en/
1112
---
1213

1314
<!-- [Leia em Português](https://blog.lmeier.net/pt-BR/posts/integrando-backstage-azure-devops/) -->

_posts/pt-BR/2024-09-15-creating-your-own-custom-lld-in-zabbix.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ description: "Um guia completo para criar um Low-Level Discovery customizado no
88
lang: pt-BR
99
image: assets/img/zabbix-custom-lld/capa.png # Removido campo duplicado
1010
layout: post
11+
redirect_from:
12+
- /pt-BR/posts/criando-seu-proprio-lld-personalizado-no-zabbix-pt-BR/
13+
- /posts/criando-seu-proprio-lld-personalizado-no-zabbix-pt-BR/
1114
---
1215

1316
<!-- *Read in [English](https://blog.lmeier.net/posts/creating-your-own-custom-lld-in-zabbix/)* -->

_posts/pt-BR/2024-10-07-monitoring-cluster-shared-volumes-with-zabbix.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ description: "Como monitorar os discos do seu cluster no Zabbix"
88
lang: pt-BR
99
layout: post
1010
image: assets/img/monitor-csv/cover.png
11+
redirect_from:
12+
- /pt-BR/posts/monitorando-cluster-shared-volumes-com-zabbix/
13+
- /posts/monitorando-cluster-shared-volumes-com-zabbix/
1114
---
1215

1316
<!-- *Also available in [english](https://blog.lmeier.net/posts/monitoring-cluster-shared-volumes-with-zabbix/)* -->

_posts/pt-BR/2024-10-18-how-i-recovered-a-bricked-cctv-camera.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ categories: [CCTV, Hardware]
88
tags: [CCTV, Hardware, Intelbras]
99
lang: pt-BR
1010
image: assets/img/bricked-camera/cover.png
11+
redirect_from:
12+
- /pt-BR/posts/como-recuperei-uma-camera-cftv-brickada/
13+
- /posts/como-recuperei-uma-camera-cftv-brickada/
1114
---
1215

1316
<!-- *Read in [english](https://blog.lmeier.net/posts/how-i-recovered-a-bricked-cctv-camera/)* -->

_posts/pt-BR/2024-10-22-fortinet-vs--palo-alto--automating-load-balancing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ categories: [Zabbix, Monitoring, Python, API, NGFW, "Palo Alto"]
88
tags: [Zabbix, Monitoring, Python, API, NGFW, "Palo Alto"]
99
lang: pt-BR
1010
image: assets/img/lb-fortinet-paloalto/cover.png
11+
redirect_from:
12+
- /pt-BR/posts/fortinet-vs-palo-alto-automatizando-balanceamento-de-carga/
13+
- /posts/fortinet-vs-palo-alto-automatizando-balanceamento-de-carga/
1114
---
1215

1316
<!-- [*Read in english*](https://blog.lmeier.net/posts/fortinet-vs-palo-alto-automating-load-balancing/) -->

_posts/pt-BR/2024-12-19-monitoring-palo-alto-firewalls-using-api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ categories: [Zabbix, Monitoring, Python, API, NGFW, Palo Alto]
88
tags: [Zabbix, Monitoring, Python, API, NGFW, Palo Alto]
99
lang: pt-BR
1010
image: assets/img/monitoring-using-api/cover.png
11+
redirect_from: /pt-BR/posts/usando-api-para-monitorar-ipsec-da-palo-alto/
1112
---
1213

1314
<!-- *Also available in* [*English*](https://blog.lmeier.net/posts/monitoring-palo-alto-firewalls-using-api/) -->

_posts/pt-BR/2025-02-04-authentication-backstage-entra-id.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ categories: [Backstage, DevOps, Cloud]
88
tags: ["Microsoft Entra ID", Authentication, "Identity Provider", Backstage]
99
lang: pt-BR
1010
image: assets/img/backstage-entraid/capa.png
11+
redirect_from: /pt-BR/posts/autenticacao-backstage-entra-id-pt-BR/
1112
---
1213

1314
<!-- [Read in English](https://blog.lmeier.net/posts/authentication-backstage-entra-id/) -->

0 commit comments

Comments
 (0)