Text gets rendered outside href in shortcode

Small but quite annoying little bug with the way href gets rendered in a shortcode.

You see that “stats for nerds” at the right bottom corner of the website?

{{ $book_name := .Get 0 }}
<div class="small p-0 m-0">
   <a href="{{ .Site.BaseURL }}journal/{{ .Get 2 }}">{{ $book_name }}</a>

In hugo server, the link gets rendered ok:

<div class="small p-0 m-0">
   <a href="http://localhost:1313/journal/mythos-a-silicon-valley-thriller/">MYTHOS A Silicon Valley Thriller (release)</a>

But when I do hugo --minify, this is what I get:

<div class="small p-0 m-0">
   <a href="http://localhost:1313/journal/mythos-a-silicon-valley-thriller/"></a>
   MYTHOS A Silicon Valley Thriller (release)

See that little bastard there? It renderedoutside the freaking link!

I’m using jQuery to grab that from a post, by the way.


$( "#nerdstats" ).load( "../../books/index.html #nerdstats__data" );

And this here is the shortcode:


{{< nerdstats "MYTHOS A Silicon Valley Thriller (release)" "100" "mythos-a-silicon-valley-thriller/" >}}

It renders as it should during server mode, but when I mix hugo with jQuery, during export? Things go wild!

Anyone knows how to solve this one?

I hacked my way using onclick to simulate the links and css styles to simulate the text-decoration when mouse over (besides cursor:pointer), so it now “works”, but hacked.

Regularly, the error will still be happening. So I’ll leave this here in case someone else finds the issue later on.

I just found a quick way around it.

Damn it feels good to be a gangster.

Could you check if this is a problem only when using --minify or whether this is Hugo related? If it is the former, please post it at https://github.com/tdewolff/minify