How to use theme only for a certain folder?
If I have content/foo and content/bar, how do I apply the theme only for foo ?
That is a good question. Hugo applies themes as filesystem overlays, so you can have multiple themes on top of each other.
The below is totally untested, but could/should in my head work:
[module]
[[module.imports]]
path = "github.com/bep/docuapi/v2"
[[module.imports.mounts]]
source = "i18n"
target = "i18n"
[[module.imports.mounts]]
source = "layouts"
target = "layouts"
[[module.imports.mounts]]
source = "layouts"
target = "layouts/foo"
[[module.imports.mounts]]
source = "assets"
target = "assets"
[[module.imports.mounts]]
source = "static"
target = "static"
Note the "double mounting" of layouts.
Also note that I'm not totally sure if the above works, but please let me know if it does.
@bep thanks for the quick reply.
I'm afraid this isn't working for me, the theme is still being loaded for both foo and bar.
@paololazzari - Did you manage to resolve this? I'm assuming you have the same use-case as me, where you want to use one theme for product documentation and docuapi theme for the product's API package?
@dannycowlishaw I couldn't get bep's suggestion to work. I ended up using redocly in a standalone page in layouts/_default/.
Would you mind explaining how you configured redocly exactly? Is it complicated? It might have to be the same workaround I put in place.
@dannycowlishaw sure, it's super easy.
layouts/_default/apireference.html:
<html>
<body>
<div>
<redoc
spec-url='./openapi.json'
>
</redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
</div>
</body>
</html>
content/product/api/api-reference.md:
---
Title: API Reference
layout: apireference
type: page
---
and content/product/api/api-reference/openapi.json is the openapi spec.
Kudos @paololazzari, that's working for me, thank you really appreciate it 😊
@dannycowlishaw you're welcome!