Skip to content

Migrate to a-h/templ Templates#336

Merged
donatj merged 5 commits intomasterfrom
templ
Apr 28, 2026
Merged

Migrate to a-h/templ Templates#336
donatj merged 5 commits intomasterfrom
templ

Conversation

@donatj
Copy link
Copy Markdown
Member

@donatj donatj commented Apr 28, 2026

No description provided.

@donatj donatj marked this pull request as ready for review April 28, 2026 10:54
Copilot AI review requested due to automatic review settings April 28, 2026 10:54
Remove static directory from gitignore while keeping specific files.

No longer need this because we're not tossing generated templates in here.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the website pages from PHP-generated static HTML to server-side rendered Go templates using github.com/a-h/templ, and wires the new pages into the Go HTTP router.

Changes:

  • Add .templ sources (and generated *_templ.go outputs) for index, dashboard, privacy, plus shared Head/Header/Footer/Shield components.
  • Replace PHP page rendering and static HTML generation with templ.Handler(...) routes in cmd/shielded/main.go.
  • Update build tooling to run go generate (templ codegen) during make build, and add templ/tool dependencies to go.mod/go.sum.

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pages/privacy_templ.go Generated templ output for Privacy page.
pages/privacy.templ New Privacy page source template.
pages/privacy.html.php Removes old PHP version of Privacy page.
pages/index_templ.go Generated templ output for Index page.
pages/index.templ New Index page source template.
pages/index.html.php Removes old PHP version of Index page.
pages/dashboard_templ.go Generated templ output for Dashboard page.
pages/dashboard.templ New Dashboard page source template.
pages/dashboard.html.php Removes old PHP version of Dashboard page.
pages/common_templ.go Generated shared components + helpers/types used by pages.
pages/common.templ Source for shared components + helper funcs/types.
pages/_head.php Removes old PHP head partial.
pages/_header.php Removes old PHP header partial.
pages/_footer.php Removes old PHP footer partial.
cmd/shielded/main.go Adds go:generate for templ + serves new templ pages via router.
Makefile Runs go generate and stops generating static HTML via PHP.
go.mod Adds templ dependency and pins templ tool.
go.sum Adds sums for new templ-related dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pages/common.templ
Comment on lines +3 to +7
import (
"net/url"

gotempl "github.com/a-h/templ"
)
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common.templ imports github.com/a-h/templ as gotempl, but the generated file also imports the same package unaliased (import "github.com/a-h/templ"), resulting in a duplicate import path in pages/common_templ.go and a Go compile error. Remove the explicit templ import/alias from this .templ file and use the generator-provided templ package for SafeURL/URL (keep only the net/url import here).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c30f45b. Removed the gotempl "github.com/a-h/templ" alias import from common.templ and updated dnsPrefetchURL/shieldURL to use the generator-provided templ.SafeURL and templ.URL. Regenerated common_templ.go — the duplicate import is gone and the build compiles cleanly.

@donatj donatj merged commit 902961f into master Apr 28, 2026
4 checks passed
@donatj donatj deleted the templ branch April 28, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants