Internal sources for `partial` or `Get` for `template`

I have a simple shortcode of an external theme.

<div class="book-expand">
  <span>{{ default "-1" (.Get 0) }}</span>
  <span>{{ default "-1" (.Get 1) }}</span>
  <div>
      {{ .Inner | markdownify }}
  </div>
</div>

I don’t intend to change it. It works great and I intend to expect it to update on the theme side.

But I need it in my layouts.

The logical way is to use partial

{{ partial "shortcodes/expand.html" (dict "0" "0" "1" "1" "Inner" . }}

But it can’t find the files because partial has strict of sources. Am I right?

The second way is template

{{ template "shortcodes/expand.html" (dict "0" "0" "1" "1" "Inner" . }}

But template doesn’t support Get function. Why!?

It is so transparent and comfortable. I could use shortcodes from other vendors without modifying their code. Am I missing something?

Copy it to your layout/partials/ and your first partial code should work.

Just my guess, didn’t try that out though.

I can to do this. You’re right.

In my case I want use the current theme with no any patches. I’m not saying that something is wrong. I just want to know if it’s possible to somehow call this?

It’s possible but my personal feeling is that the implementation will be very, very ugly.

Themes are treated as individual modules. Better to keep it that way.

1 Like

Not possible.

2 Likes