Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileserver: Extract default browse template into a separate file #4417

Merged
merged 1 commit into from
Nov 15, 2021

Conversation

jjlin
Copy link
Contributor

@jjlin jjlin commented Nov 13, 2021

This makes it easier for users to find the default browse template if they
want to create a custom template based on that. It also makes it easier to
view the template with proper syntax highlighting.

@jjlin
Copy link
Contributor Author

jjlin commented Nov 13, 2021

Note that this PR uses the file embedding capability introduced in Go 1.16, but Caddy currently requires at least that version to build, so that should be fine.

@francislavoie francislavoie added the feature ⚙️ New feature or request label Nov 15, 2021
@francislavoie francislavoie added this to the v2.5.0 milestone Nov 15, 2021
Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

Thanks for this, I was thinking of doing this change at some point, but you got to it first 😄

Unfortunate that we lose git history from moving the contents to another file, but we gain from syntax highlighting etc.

We'll also need to update the docs once merged to link to the .html file instead. See https://caddyserver.com/docs/caddyfile/directives/file_server

modules/caddyhttp/fileserver/browsetpl.go Outdated Show resolved Hide resolved
This makes it easier for users to find the default browse template if they
want to create a custom template based on that. It also makes it easier to
view the template with proper syntax highlighting.
@jjlin
Copy link
Contributor Author

jjlin commented Nov 15, 2021

We'll also need to update the docs once merged to link to the .html file instead. See https://caddyserver.com/docs/caddyfile/directives/file_server

Thanks, I didn't know there was a reference to the template. I opened caddyserver/website#196.

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Thank you for this. It'll be our first time using go:embed features, so we'll give it a shot!

@mholt mholt merged commit e81369e into caddyserver:master Nov 15, 2021
@jjlin jjlin deleted the browsetpl branch November 16, 2021 22:47
mholt pushed a commit to caddyserver/website that referenced this pull request Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants