home/web/template/page.qtpl
Maxim Lebedev 0f909007d8
All checks were successful
/ docker (push) Successful in 1m4s
💄 Unsafe renders page content
2023-11-08 07:43:38 +06:00

42 lines
706 B
Plaintext

{% import (
"golang.org/x/text/language"
"source.toby3d.me/toby3d/home/internal/domain"
) %}
{% code
type Page struct {
BaseOf
page *domain.Page
}
func NewPage(base BaseOf, page *domain.Page) Page {
return Page{
BaseOf: base,
page: page,
}
}
%}
{% stripspace %}
{% func (p Page) Title() %}
{% if p.page.Title != "" %}
{%s p.page.Title %}
{% else %}
{%= p.BaseOf.Title() %}
{% endif %}
{% endfunc %}
{% func (p Page) Lang() %}
{% if p.page.Language != language.Und %}
{%s p.page.Language.String() %}
{% else %}
{%= p.BaseOf.Lang() %}
{% endif %}
{% endfunc %}
{% func (p Page) Body() %}
<p>{%z= p.page.Content %}</p>
{% endfunc %}
{% endstripspace %}