# How to avoid a shortcodes hell

**URL:** <https://discourse.gohugo.io/t/how-to-avoid-a-shortcodes-hell/33267>\
**Category:** support\
**Created:** [June 7, 2021, 3:24am UTC](https://discourse.gohugo.io/t/how-to-avoid-a-shortcodes-hell/33267 "2021-06-07T03:24:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![oshliaer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/oshliaer/32/1641_2.png) [@oshliaer](https://discourse.gohugo.io/u/oshliaer)\
**Post date:** [June 7, 2021, 3:24am UTC](https://discourse.gohugo.io/t/how-to-avoid-a-shortcodes-hell/33267/1 "2021-06-07T03:24:05Z")

</div>

I’m using several unstable supported themes. I use shortcodes to extend them.

Another reason for using shortcodes is that some functions should not be repeated in every archetype. It depends on the mind context of the article.

I stepped onto thin ice 🥶

There are already more than 10 shortcodes. And once again I need to update some of the articles to add a new shortcode.

What should I do? I don’t want to change the theme layer because I don’t want to depend on theme updates, I would rather use updates right away.

The real sample [GitHub - contributorpw/google-apps-script-snippets-hugo-site: The Hugo static site for google-apps-script-snippets](https://github.com/contributorpw/google-apps-script-snippets-hugo-site)  
At the moment, I only need to add shortcode `{{< clipboard >}}` to posts that contain copy code. Not every code needs to be copied.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [June 7, 2021, 5:50am UTC](https://discourse.gohugo.io/t/how-to-avoid-a-shortcodes-hell/33267/2 "2021-06-07T05:50:14Z")

</div>

> [@oshliaer](#):
>
> What should I do? I don’t want to change the theme layer because I don’t want to depend on theme updates, I would rather use updates right away.

You need to go through the [Requesting Help](https://discourse.gohugo.io/t/requesting-help/9132) guidelines and share a repository that reproduces the issues you encounter.

Also you need to be specific when opening a support ticket.  
We cannot know what is going on from the above post.

---

<div class="post-metadata">

**Author:** ![fekete-robert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fekete-robert/32/13363_2.png) [@fekete-robert](https://discourse.gohugo.io/u/fekete-robert)\
**Post date:** [June 7, 2021, 6:09am UTC](https://discourse.gohugo.io/t/how-to-avoid-a-shortcodes-hell/33267/3 "2021-06-07T06:09:36Z")

</div>

IIRC, you can put shortcodes independently from the theme into the /\_default/shortcodes/ folder, and Hugo will pick up these shortcodes. (If you have a shortcode with the same title both in the theme and in the repo, the one in the repo wins.) Or if you have multiple repos where you want to use these shortcodes, you can try to layer a separate theme that contains your shortcodes with the theme composition feature, see [Add support for theme composition and inheritance · gohugoio/hugo@80230f2 · GitHub](https://github.com/gohugoio/hugo/commit/80230f26a3020ff33bac2bef01b2c0e314b89f86)

---

<div class="post-metadata">

**Author:** ![oshliaer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/oshliaer/32/1641_2.png) [@oshliaer](https://discourse.gohugo.io/u/oshliaer)\
**Post date:** [June 7, 2021, 6:42am UTC](https://discourse.gohugo.io/t/how-to-avoid-a-shortcodes-hell/33267/4 "2021-06-07T06:42:21Z")

</div>

It’s amazing!

I should definitely try composition instead of using the monolith theme.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [June 9, 2021, 6:42am UTC](https://discourse.gohugo.io/t/how-to-avoid-a-shortcodes-hell/33267/5 "2021-06-09T06:42:55Z")

</div>

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