How to access my shortcode variable inside _index.md

+++
title = "TEST ABOUT" | **HOW TO USE MY PARAMS CUSTOME VARIABLE FOR DYNAMIC TITLE FOR   EX: {{ .Site.Params.myVar }} + "ABOUT"** I want to concat variable with string
description = ""
weight=20
+++
{{%excerpt%}}
	{{% myVar %}}
	{{<myVar /> }} 
{{/%excerpt%}}

If I have add this in my _index.md :

+++
title = {{ .Site.Params.myVar }} + "ABOUT"
+++

Expected Output :

+++
title = Test1 ABOUT
+++

+++
title = Test2 ABOUT
+++

+++
title = Test3 ABOUT
+++

Hi, for people to be able to better help you, please take a little more time to:

  1. Explain your set-up / what your workflow is
  2. Explain what you are fundamentally trying to do – there might be an easier/more-integrated/different way to accomplish this.
  3. Clearly indicate input and output (code blocks are useful for this)

But, from what I can tell :

Page front matter is generated when the file is created (of course you can manually change it, or create a script to do it, too.).

You can use Hugo Archetypes to pre-define what a new content file looks like and within that use templating logic to automatically fill in front-matter. However, you might be limited as to what parameters / information you have access to at this point.

Thanks a lot, another thing I want to know It’s possible to use {{ .Site.Params.myVar }} in _index.md

My variable is define in config.toml

Because, I want to change content text dynamically.

INPUT :

{{ .Site.Params.myVar }} ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Commodo quis imperdiet massa tincidunt nunc pulvinar sapien et ligula. Sit amet consectetur adipiscing elit duis tristique. Magna sit amet purus {{ .Site.Params.myVar }}.

OUTPUT:

TEST ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Commodo quis imperdiet massa tincidunt nunc pulvinar sapien et ligula. Sit amet consectetur adipiscing elit duis tristique. Magna sit amet purus TEST.

Ah, this is a little different. There seems to be 2 cases :

  1. Auto filling page front matter (on file creation)
  2. Dynamically changing rendering content – to be edited in content (i.e. content/_index.md) not in template (i.e. layouts/index.html)

For case 1:

TBH, I’m not entirely sure what all variables you have access to at file creation time. You know you have access to some of the variables created in the command line, I’m not sure if you will have access to .Site. Though this should be easy to test.

For case 2 :

See: Inline Shortcodes which should get you what you want, again, assuming, that you would like to place theses values around in you Markdown.

For case 1:
in this you suggest me Hugo archetypes it useful for new file, but if I want to change title in already created file so how would I do that

I would imagine that that could be taken care of with external bash scripts – which is out of my wheel-house. Though I cannot image it being too difficult (assuming that you handle edge cases).