How can you pass in a variable as a shortcode's argument value?

I don’t exactly understand what you are trying to do …

Maybe passing the result of one shortcode to another on at different locations on the same page…

  • I suppose you enabled inline shortcodes in your config.

  • Your first line is not valid in a markdown file.

    • it is tempale code
    • you cannot create a variable in markdown
    • course-link is not a function

General things:

  • shortcode can call partials
    So you could pass the string to the info shortcode and evaluate it there

  • you can nest shortcodes
    Shortcodes | Hugo

  • look at page scratch and store methods
    This enables you to create “variables” on page level that can be set and get from different shortcodes, partials…

  • this one seems pretty close at least get an idea Use front matter defined variables as argument in custom shortcode

1 Like