Using {slug} in HTML Card

Hello all, I’m attempting to do something that I believe to be simple, but I can’t figure it out as of yet. I simply want to add a parameter in an HTML card that will reference the post’s {slug}. My intent is to create a template using the snippet feature, and I want that template to include the slug that will automatically reference the current post’s slug.

Is this possible?

<html>
   <body>
      <p style="font-family: serif; font-size: 18px">
         <i>read on</i> <u><a href="https://www.website.com/slug/" target="_blank">website.com</a></u>
      </p>
   </body>
</html>

The post contents are not dynamically generated, so it’s not possible to do something like that. However, you can use javascript to change the URL on the client side.

2 Likes

Awesome thank you! Could provide a little more insight as to how I do that please?

In your snippet, you can add something like this:

<a class="link-to-current" href="#/current">link</a>
<script>
document.querySelectorAll(.'link-to-current').forEach(node => node.href = window.location.href);
</script>
1 Like