I need to use part of file name in a link in markdown

I need to create a feedback link for about 10 pages. They have decent file names that uniquely identify each page. What I need to do is to extract part of the file path (say - filename for convenience’s sake, even though that would actually be parent directory name) and use it inside the link like this: https://limesurvey.org/23456?hiddenquestion=filename

How should I do this?
I run into the snag that I cannot use curly-curly braces in markdown.

The “curly-curly braces in markdown” are known as “actions”.

In this case, your should create a shortcode.

layouts/shortcodes/survey.html

{{ $api := "https://limesurvey.org/23456" }}
{{ $qs := querify "hiddenquestion" .Page.File.ContentBaseName }}
<a href="{{ printf "%s?%s" $api $qs }}" rel="external">Survey</a>

markdown

{{< survey >}}
1 Like

Thanks, this looks good. I will try and it will help me understand shortcodes too.

Yes, this works precisely as needed. I will now work on a bit of understanding, but thanks very much. Solution ready to use!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.