Skip to content

Fix header.lp closing head tag formatting#3607

Merged
rdwebdesign merged 1 commit into
pi-hole:developmentfrom
h3xcat:patch-1
Sep 18, 2025
Merged

Fix header.lp closing head tag formatting#3607
rdwebdesign merged 1 commit into
pi-hole:developmentfrom
h3xcat:patch-1

Conversation

@h3xcat

@h3xcat h3xcat commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

Thank you for your contribution to the Pi-hole Community!

Please read the comments below to help us consider your Pull Request.

We are all volunteers and completing the process outlined will help us review your commits quicker.

Please make sure you

  1. Base your code and PRs against the repositories developmental branch.
  2. Sign Off all commits as we enforce the DCO for all contributions
  3. Sign all your commits as they must have verified signatures
  4. File a pull request for any change that requires changes to our documentation at our documentation repo

What does this PR aim to accomplish?: Fixes an HTML structure issue in scripts/lua/header.lp where the closing </head> tag was missing. This improves standards compliance and ensures correct rendering in browsers and tools that rely on well-formed HTML.

image

How does this PR accomplish the above?: Adds the missing </head> tag before the <body> tag.

Link documentation PRs if any are needed to support this PR: N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

@h3xcat h3xcat requested a review from a team as a code owner September 17, 2025 23:38
@rdwebdesign

rdwebdesign commented Sep 18, 2025

Copy link
Copy Markdown
Member

You are correct about the missing closing tag, but this is the wrong place to add this closing tag.

The file header.lp is loaded inside header_authenticated.lp.

header_authenticated.lp includes header.lp and already closes the tag (line 24):

mg.include('header.lp','r')

<script src="<?=pihole.fileversion('scripts/js/logout.js')?>"></script>
</head>
<body class="<?=theme.name?> hold-transition sidebar-mini <? if pihole.boxedlayout() then ?>layout-boxed<? end ?> logged-in page-<?=pihole.format_path(mg.request_info.request_uri)?>" data-apiurl="<?=pihole.api_url()?>" data-webhome="<?=webhome?>">

Your fix, adding the </head> tag in header.lp, will generate invalid HTML code on every page that includes the file header_authenticated.lp.

These pages will contain 2 </head> tags (click to show)image


Only 3 pages load header.lp directly and miss the closing tag:

  • login.lp;
  • error403.lp and
  • error404.lp.

The correct way to fix this is to add the </head> tag on these 3 files, right before the <body> tag.

Signed-off-by: H3xCat <2304691+h3xcat@users.noreply.github.com>
@rdwebdesign rdwebdesign merged commit 1edd4e7 into pi-hole:development Sep 18, 2025
8 checks passed
@h3xcat h3xcat deleted the patch-1 branch September 18, 2025 08:10
@PromoFaux PromoFaux mentioned this pull request Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants