acaloiaro / hugo-htmx-go-template

Make static Hugo sites dyanmic with htmx and Go
https://adriano.fyi/posts/2023/2023-07-04-making-hugo-static-sites-dynamic-with-htmx-and-go/
116 stars 13 forks source link

using standard go templates #6

Closed gedw99 closed 1 year ago

gedw99 commented 1 year ago

any way we can also use standard go templates ?

templ is cool, but would be nice to also be also be able to use standard ones without need for complation.

acaloiaro commented 1 year ago

Templ is mostly used only for example purposes. It is in no way a requirement.

As you can see here, a standard html/template is used: https://github.com/acaloiaro/hugo-htmx-go-template/blob/main/server.go#L66

Feel free to use the template system that's most convenient for you. Since we're dealing with standard Go here, every Go template system is available.

On Wed, Jul 19, 2023, at 10:37, Gerard Webb wrote:

any way we can also use standard go templates ?

templ is cool, but would be nice to also be also be able to use standard ones without need for complation.

— Reply to this email directly, view it on GitHub https://github.com/acaloiaro/hugo-htmx-go-template/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZNMQGQ4PYNBXBNUF3D5J3XRAEOJANCNFSM6AAAAAA2QGDBP4. You are receiving this because you are subscribed to this thread.Message ID: @.***>

acaloiaro commented 1 year ago

Sorry @gedw99 I just re-read that code and realized that while it was previously a standard html/template, it is now indeed a templ template like you said.

I'd be happy to accept a PR that adds a simple html/template example.

gedw99 commented 1 year ago

Didn’t the project use standard templates in the past ?

If so we could look back and then add standard templates again.

gedw99 commented 1 year ago

Shows when it used to use normal go html templates. I would like to have both.

https://github.com/acaloiaro/hugo-htmx-go-template/commit/e883eefcfc0f3b8ee26d3150f5469c44f7bbeb22#diff-366e46a40f6f60b4f7614eb0976bb51820364bf5ca6ccc4787eb49d7bdbef3e6

acaloiaro commented 1 year ago

Turns out I'm not crazy. The hello world example still uses html/template: https://github.com/acaloiaro/hugo-htmx-go-template/blob/main/server.go#L60

I just happen to use tmpl as the variable name :)