canstand / compost

Compost is a simple theme for Hugo built with tailwindcss.
https://canstand.github.io/compost/
MIT License
51 stars 14 forks source link

article-meta outputs escaped html so browser can't render it #2

Closed solomkinmv closed 10 months ago

solomkinmv commented 10 months ago

Hello, thank you for your theme. I really like how minimal and light it is! I've noticed strange behavior when article-meta concats all meta partials it outputs following html:

<time datetime="2019-03-11 00:00:00 +0000 UTC">11 March 2019</time><span class="px-2 text-primary-500">·</span><span title="Reading time">3 mins</span><span class="px-2 text-primary-500">·</span>
image

The same happens for my site and for your example site.

I'm using go version go1.21.5 darwin/arm64. I've tried theme versions v0.6.0 and v0.6.3.

Removing concatenation and appending partials manually fixes the problem.

    {{ with ($meta.Get "partials") }}
      {{ delimit . "<span class=\"px-2 text-primary-500\">&middot;</span>" }}
    {{ end }}

to

    <time datetime="{{ .Date }}">
      {{- .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" -}}
    </time>
    <span class="px-2 text-primary-500">&middot;</span>
    <span title="{{ i18n "article.reading_time_title" }}">
    {{- i18n "article.reading_time" .ReadingTime | emojify -}}
    </span>

Manual usage of all three partials also works fine.

I've tried to find the problem with the template, but I couldn't.

canstand commented 10 months ago

fixed with v0.6.4

solomkinmv commented 10 months ago

Thanks, now it works!