Fetching a partial in the root level from a theme

I’m working on a theme and I want the user to provide a HTML snippet to embed in part of the site. According to the docs on partials, it should look in the root level and then the theme, but this doesn’t seem to be working for me. The reason for this may be that the HTML where I am requesting the partial is inside the theme subdirectory, where it is expected to be in the root level.

I am unable to reproduce your problem.

Please post a link to the public repository for your site. See:
https://discourse.gohugo.io/t/requesting-help/9132

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Here’s an example of doing this sort of thing:

In your theme-dir/layouts/whatever.html file:

{{- partial "home/hero.html" . -}}

And then the theme consumer will include their own file at:

./layouts/partials/home/hero.html

You can see this in action here: https://github.com/pypyr/pypyr-docs/blob/master/layouts/index.html

Sorry about that, this is the repo https://github.com/samrobbins85/next-portfolio-website

themes/tailwind-developer-website/layouts/index.html

{{- partial "main1.html" . -}}

but…

layouts
└── partials
    └── main.html

Yeah, but when I change it to main.html it doesn’t compile, so I left it like this

What’s the error message?

For some reason it just started working, not quite sure why, but thanks for your help