Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Translations of a page are not linked with hreflang, so search engines treat them as unrelated pages

Abierto
#606 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@guidol-ive ya está trabajando en esto.

Desde el 28/10/2026.

  • #610 de @guidol-ive — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
html, javascript

Línea de trabajo

The issue links open pull request #610, which already implements the proposal. Review that pull request and the existing hypha_setBodyClass(), HTMLDocument::linkStyle(), and hypha_indexLanguages() entry points to understand the change. The requested result is reciprocal alternate links for translated pages, an x-default link, and hreflang attributes on language-list links, with no annotations on single-language pages or views.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Impact: Medium Level: Easy Pagetype: Text Type: Enhancement Value: Visitors

Hypha stores the translations of a page together (one page in hypha.xml with a language child per translation), and shows them in the language list next to the page name. Search engines are not told: no page has <link rel="alternate" hreflang="...">, and the links of the language list carry no hreflang. Google and Bing therefore treat nl/Over_ons and en/About_us as unrelated pages, may show the Dutch page to an English searcher, and may consider near-identical translations as duplicates.

Evidence (PHP 8.2 container of docs/container, fictional test site, page nl/Over_ons with English translation en/About_us):

$ curl -s http://127.0.0.1:8172/nl/Over_ons | grep -c 'hreflang'
0
$ curl -s http://127.0.0.1:8172/nl/Over_ons | grep -o '<span class="language"><a[^>]*>'
<span class="language"><a href="en/About_us">

Proposal (as described by Google, "Tell Google about localized versions of your page", and RFC 8288 for rel="alternate"):

  1. Every page that exists in more than one language gets in its head one <link rel="alternate" hreflang="<code>" href="<absolute url>"> per translation, its own language included (the annotations must be reciprocal).
  2. One extra hreflang="x-default" link points to the version in the site's default language.
  3. Only the page itself, not views such as edit or translate, and not a page with one language.
  4. The links of the language list (hypha_indexLanguages()) get hreflang as well.

The linked pull request does that in a new hypha_setAlternateLinks() next to hypha_setBodyClass(), with a small HTMLDocument::linkAlternate() next to linkStyle().

Related, not part of this: <html lang> per content language, canonical URLs, title and description (#521); Vary: Accept-Language (#593); the sitemap could list the alternates too (#375). Page names outside ASCII need #541 for the alternate URLs to resolve.

🤖 Generated with Claude Code

Lenguaje dominante
JavaScript
Estrellas
5
Forks
9
Merge medio
18 h 7 min
PR fusionados (30 d)
11

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PlanBCode/hypha

Todos los issues de PlanBCode/hypha

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.