Search code examples
slim-lang

Slim: Append text to printed Ruby variable


I have the following Slim snippet:

a href = data.api.docs Clicky

What the output is:

<a href="https://docs.example.com/api">Clicky</a>

What I want the output to be:

<a href="https://docs.example.com/api#some-subsection">Clicky</a>

How do I append the #some-subsection to the URL variable in Slim?


Solution

  • Figured it out .. I just had to do:

    a href = data.api.docs+"#some-subsection" Clicky
    

    .. to generate:

    <a href="https://docs.example.com/api#some-subsection">Clicky</a>