Shortcode equivalent for layout/partials?


I would like to know is there any possibility to create “shortcode” which working directly on Layout or partial file?


Most likely you’re going to end up using front matter parameters to “pass” information to the template file. Then, when the template detects that the front matter variable was set, it does whatever you are wanting it to do.


Thanks for the answer but it’s not what i want to know. I would to know if it’s possible to create function like “shortcode” in .md but for layouts and partials ?


Are you talking about partials?

It sounds like you are wanting to create something like shortcodes that you can use inside of templates (layouts, partials, etc.). Those would be partial templates. You can pass multiple parameters to a partial template by using a slice, dict, .Scratch as the context (the parameter after the partial path), and/or using front matter/site config variables.