Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Duplicate H1: hidden screen-reader title H1 rendered alongside custom layout H1 when page title is hidden

未关闭
#4,652 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@HardeepAsrani 已经在做这个了。

开始于 2026年10月12日。

  • #4658 来自 @HardeepAsrani —— 未关闭

评估

难度
4/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
php, wordpress

调研方向

Start by reading views/page-header.php, especially the hidden-title branch and its H1 check, then trace inc/views/page_header.php to understand how the view is hooked. Try reproducing the case with a hidden title and a Custom Layout H1 on both a regular page and the posts page. Done means the page renders only the custom layout H1; no relevant test coverage was found, so identify or add a regression check.

由索引模型根据 Issue 内容生成。

描述

bug-report bug-report-triage customer report

Summary

When a page's title is hidden and a Custom Layout supplies its own H1, the page ends up with two H1 headings. The second is Neve's visually hidden title.

Expected: only one H1 on the page, the one from the custom layout.
Actual: Neve outputs an extra H1 with the screen-reader-text class in addition to the custom layout H1.
Impact: SEO and heading-checker tools flag multiple H1s on the page.

Customer context

  • Product / area: Neve page header with Neve Pro Custom Layouts
  • Version: Not provided
  • Environment: Page using a custom layout with an H1 heading; the page title is hidden (inferred)
  • Integration / third party: Neve Pro custom layouts
  • Reported error / symptom: Two H1 headings reported on a page that uses a custom layout
  • Impact: SEO concern; customer is using a heading checker

Reproduction notes

Not reproduced. Likely steps (inference): 1) Hide the page title through the global setting or the per-page setting. 2) Add a Neve Pro Custom Layout that renders an H1. 3) Inspect the frontend HTML for two H1 elements. Missing: Neve and Neve Pro versions, and the exact custom layout hook.

Diagnosis

Conclusion

When the title is hidden, views/page-header.php outputs a visually hidden H1 unless it finds an H1 in the post's raw post_content. Markup injected by a custom layout or hook is not in post_content, so the check does not see it and a second H1 can render. This is inferred from reading the code; no runtime reproduction was done.

Where this likely occurs
  • views/page-header.php approx. lines 15-27 and 46-56 (hide-title decision and the else branch): $content_has_h1 is computed from get_post_field('post_content') only. If false, it echoes the screen-reader-text H1.
  • inc/views/page_header.php — Page_Header::run() line 43 and render_page_header() lines 53-67 hook the view into neve_page_header at priority 9.
  • The page the customer linked is not necessarily the blog page. The staff reply described the case as the blog/posts page, via is_home. The archive hide-title default at lines 21-23 of the view may be involved.
Engineering notes

The H1 check looks only at post content. It does not look at output from other sources such as Neve Pro custom layouts hooked into the page header. Neve Pro was only grepped for neve_page_header usage; the custom layout rendering code was not inspected in depth. Custom layouts may also inject at other hooks.

Test coverage status

No relevant coverage was found during inspection (not exhaustive).

What to verify or explore next
  • Reproduce with a Custom Layout containing an H1 on the posts page and on a regular page, with the title hidden, and count the H1 elements.
  • Check whether archive and blog pages hide the title by default for new users via neve_archive_hide_title.
Unknowns / follow-up
  • Theme and Pro versions, and the hook where the customer's layout renders.
  • Whether an open issue already tracks this.

Confidence

Confidence: 70/100

The hidden-title branch in views/page-header.php only checks the post's raw content for an H1. A custom layout that outputs its own H1 is not detected, so a second H1 renders. No existing GitHub issue was searched, and I did not inspect customer-side layout markup.


Source: HelpScout #3479313350
Generated by bug-report-triage (ID: bug-report-triage_6acb421c5ba113.05905873)

主要语言
PHP
星标
307
派生
88
平均合并
2 天 21 小时
30 天内合并 PR
15

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Codeinwp/neve 的其他 Issue

查看 Codeinwp/neve 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。