Control the palcement of shortcodes in single.html?

I have a shortcode that is an accordion menu. however it can only be placed within the content part of the page. i want to place that accordion in a sidebar to the side. is it possible to control the placement of this? or use a partial or some other way instead?

Shortcodes are only for content. Partials are only for templates.

If you want to reuse code, create a partial and then call that partial from a shortcode.

I have an index.md

heading1

blah blah info

{{}}
some stuff
{{</short code>}}

i have a single.html

{{ define “main” }}

{{content}}
where i have the sidebar that should take the shortcode and display it here
{{ end }}

I am not sure if what you suggested will solve my problem. but i will try

I was to concise in my answer I realise.

To place the accordion menu outside of the post content you need to add it to a template.

You do not say what the content of the accordion is. If it should come from the post you can define it in the frontmatter or a page bundle resource to name some options.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.