Why can I not use markdown in hugo

Hi,

I am struggling in using markdown with hugo. I have the hugo-creative-theme as an example, and now I am trying to insert an link. For example like this (in the config.toml file):

[params.hero]
	slogan     = "This is an [example](http://example.com)"

But the markdown is not converted to an link. Why?

You probably have to look inside the theme and see where the .Params.hero.slogan is used.

As you can see subtitle is passed to markdownify but slogan is not. You can set the link in subtitle or modify the theme and pass slogan to markdownify like it is done for subtitle.

It’s in https://github.com/digitalcraftsman/hugo-creative-theme/blob/master/layouts/partials/hero.html

{{ "<!-- HEADER -->" | safeHTML }}
<header>
    <div class="header-content">
        <div class="header-content-inner">
            <h1>{{ with .Site.Params.hero.slogan }}{{ . }}{{ end }}</h1>
            <hr>
            <p>{{ with .Site.Params.hero.subtitle }}{{ . | markdownify }}{{ end }}</p>
            <a href="#about" class="btn btn-primary btn-xl page-scroll">{{ with .Site.Params.hero.buttonText }}{{ . }}{{ end }}</a>
        </div>
    </div>
</header>

@digitalcraftsman wrote the theme, he would know.

@parsiya’s explanation is correct.

To make it a bit easier for you I added the markdownify function to the slogan as well:

1 Like

Tranks for the help! It works now.