[Update] If I manually set the _plugins/ path in the end user’s config to the path of the custom theme gem’s _plugins/ dir (/opt/homebrew/lib/ruby/gems/3.0.0/gems/custom-theme-gem-0.0.1/_plugins/), I start making progress – but this is not an ideal solution…Still chugging…
You should not expect pages to be bundled in a theme. The user needs to have control over all the pages themselves.
Layouts in a theme - yes. For example if you want to provide a contact page, create a contact.html layout to be used by the end user if they want.
Regarding plugins. Check the rule in your gemspec file to ensure that the plugins directory gets bundled. And then inspect the installed theme in the site to see that it has a plugins directory.
Hmm…Good to know. Does this also apply to the site index?
And am I missing this in the documentation somewhere? I would be happy to add it if it’s not.
Re: local plugins
My spec.files looks like this currently (which includes those pesky pages):
spec.files = `git ls-files -z`.split("\x0").select do |f|
f.match(%r!^(assets|_layouts|_pages|_includes|_sass|_plugins|LICENSE|README|CHANGELOG|_config\.yml|index\.html)!i)
end
And if I run $ gem contents on the custom theme gem, the expected _plugins/ are all there. So, the files are definitely being added, but for whatever reason the end-user usage of the theme is not scanning the local plugins in the theme by default. But if I explicitly add the _plugins dir in the end-user configs jekyll is somehow forced to finally see the custom-theme-gem-local-plugins:
# in end user's _config.yml
plugins_dir: "/opt/homebrew/lib/ruby/gems/3.0.0/gems/custom-theme-0.0.1/_plugins/"
Any ideas about that one?
(I’m hoping I just have a setting wrong, or something)
With gem-based themes, some of the site’s directories (such as the assets, _layouts, _includes, and _sass directories) are stored in the theme’s gem, hidden from your immediate view.
Since pages and plugins are both not mentioned, I’m thinking plugins – like pages – just aren’t handled for custom theme gems.
Also, since Jekyll::PluginManager.conscientious_require only looks for plugin files once, that might be the source of the issue…Meaning jekyll just doesn’t support plugins in custom theme gems.
At least, if I am understanding this all correctly.