gofiber/template

fiber/django template uses its own non-standard `{{embed}}` tag.

Closed this issue · 0 comments

The fiber/django template uses its own non-standard {{embed}} tag, and I am not entirely sure why. Although, I think it may have been done to create a common approach across different templating engines. It's not a standard tag, and maybe we don't want to do this.

I believe that the Django way to do the same, would be to use the following template code:

{% extends layouts/main.django %}

{% include "partials/header.django" %}
<h1>{{ Title }}</h1>
{% include "partials/footer.django" %}

and then this in the parent (layout):

{% extends "layouts/main.django" %}

{% block content %}
{% include "partials/header.django" %}
<h1>{{ Title }}</h1>
{% include "partials/footer.django" %}
{% endblock %}

With that, this would be the code to execute with a layout:

func Test_XSS(t *testing.T) {
	engine := New("./views", ".django")
	err := engine.Render(&buf, "index", map[string]interface{}{
		"Title": "Hello, world!",
	})
}

Originally posted by @sixcolors in #326 (comment)