just to get the point for me: Why cant you just using the a
selector in your sass/css?
if you want to add classes to the HTML a
tag, you will have to either:
-
shortcode in Markdown
customize the build in shortcode (
ref
) or create your own (maybe (refPdf) (Create your own shortcodes | Hugo) -
custom link render hook
copy the code and add your class for that specific stuff see (Link render hooks | Hugo)
the shortcode is easier, as you can have one exactly for these PDFs - if you want to style ALL markodwn links, than the Render Hook would be a good choice.
You could also:
enable inline HTML for markdown
(Configure markup | Hugo)
renderer.unsafe
(bool
) Iftrue
, Goldmark renders raw HTML mixed within the Markdown. This is unsafe unless the content is under your control. Default isfalse
.
-
add this to your config:
[markup.goldmark.renderer] unsafe = true
-
use this in your markdown file
<a class="pdf-link" href="./Bernard_et_al_2024_Frontiers_in_public_health.pdf">Click here</a>
workaround : use a layout file
This will only apply if you want ALL links in your content/recherche
to be styled the same.
-
copy
layouts/_default/single.html
tolayouts/recherche/single.html
-
change
class="content-wrap"
toclass="content-wrap pdflinks"
-
add a selector to your sass file
.pdflinks a { color: red; background-color: yellow; }
workaround : page specifc css // conditional single partial
This will only apply if you want ALL links in your content/recherche
to be styled the same.
you could an additional stylesheet to your recherche using conditionals in base-of, create new baseof for recherche