lukeorth / poison

Professional Hugo theme for dev bloggers. Based on Mdo's classic Hyde theme.
https://poison.lukeorth.com
GNU General Public License v3.0
199 stars 98 forks source link

Allow HTML to be rendered in sidebar description #123

Closed jcoffa closed 12 months ago

jcoffa commented 1 year ago

This would allow links and line-breaks to be used:

[params]
description = 'A portfolio for <a href="https://www.my-company.com">work</a><br>A tech blog for fun'

Which would render like:

image

I believe the change could be small as well; the description can be piped into the safeHTML function inside layouts/sidebar/title.html like so:

<div class="sidebar-about">

    <!-- ... -->

    <p class="lead">
    {{ with .Site.Params.description }}{{. | safeHTML}}{{end}}
    <!--                                   ^^^^^^^^^^ new change -->
    </p>
</div>
lukeorth commented 12 months ago

Thank you, @jcoffa! Great suggestion, and an easy copy/paste solution.