[Solved] Unable to get ".Site.Data" when combining shortcode and partials

Hello All,

I am trying to create a website with dynamic/static pages with different url end points. Here is an example of the layout:

localhost:1313 => /index.html
/about => /content/about/index.md ( about.html partial )
/portfolio => /content/portfolio/index.md ( portfolio.html partial )

Some of the partial pages are loading their data from the “data” folder via {{.Site.Data}}.
I can get items in the data folder to display via {{range .Site.Data.ContentName }} in the index.html page. But, the same information does not display in partials “about.html” or “portfolio.html.” These partials are being called using shortcode in the about.md and portfolio.md markdown.
Each markdown is then being displayed via /default => single-page.html.
Which is a simple {{partial "header.htm" . }} {{.Content}} {{partial "footer.html" . }}

// Fixed, need to add “.” after the "(.Get 0) for this issue.

{{ partial (.Get 0) . }}
{{< partial “partial-name” >}}

Is there any work around to this problem? Thank you.

Never mind, solved.

Could you please post your solution as well? Might be others are interested due to having the same question.


Sorry! It was a really quick fix.

{{ partial (.Get 0) . }}

Adding the “.” at the end allows partial shortcode to load “.Site.Data”