Translations of a page are not linked with hreflang, so search engines treat them as unrelated pages
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 20/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- html, javascript
- Lĩnh vực
- internationalization, search
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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"):
- 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). - One extra
hreflang="x-default"link points to the version in the site's default language. - Only the page itself, not views such as
editortranslate, and not a page with one language. - The links of the language list (
hypha_indexLanguages()) gethreflangas 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
- Ngôn ngữ chính
- JavaScript
- Star
- 5
- Fork
- 9
- Merge trung bình
- 19 giờ 10 phút
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PlanBCode/hypha
-
Component: User interface Impact: Low Level: Easy Pagetype: Peer reviewed article Type: Bug Value: Visitors
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Medium Level: Easy Type: Bug Value: Users
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Impact: Low Level: Easy Type: Bug Value: Coders
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
PlanBCode/hypha#586 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PlanBCode/hypha
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
srikanth235/centraid#1155 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
microsoft/monaco-editor#5563 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Package downloads never retry: getUrlWithResuming's retry catch cannot see a rejected requestĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày