CSS class to markdown post files

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:

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) If true, Goldmark renders raw HTML mixed within the Markdown. This is unsafe unless the content is under your control. Default is false.

  • 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 to layouts/recherche/single.html

  • change class="content-wrap" to class="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