Skip to content

Conversation

@dballard
Copy link

@dballard dballard commented Aug 17, 2025

Add target config setting and front matter variables so one could create multiple outputs from a single site codebase with various target site included files"

This is a 🙋 feature or

  • I've added tests (if it's a bug, feature or enhancement)
  • I've adjusted the documentation (if it's a feature or enhancement)
  • The test suite passes locally (run script/cibuild to verify this)
    • note: it fails with the same 3 failures as the master branch currently appears to be for me

Happy to extend documentation further if you want to accept this feature, but if not (which totally fine!) and it's just a patch I'm maintaining, I might not get to that. So let me know what you think.

Summary

Not sure if the jekyll team wants this but here we go:

I host a jekyll site on my $domain.com and also mirror it as a tor onion service. So two nginx configs for two domains pointing at the same _site dir. I've recently thought of the idea if what if I could have some onion site only content. To do that I'd need to generate the site twice, no problem, and point the onion service address at the second site. Super season since jekyll build supports configfile stacking and overriding so I just change the destination to _site_onion in it and easy, two duplicate sites.

Now for the fun part, how to tag and filter content?

So with this MR I've added an optional (set to "default" by default) new site.configuration data called target, and added a matching field to frontmatter for pages and documents.

Then I updated write? checks to make sure there was a match (with the frontmater check being a .fetch() with the site's target as the default. Which means if either or both are unset, it's included, it's only when the site.target has a set value
that does not match the frontmatter target that it won't get output.

(I also had to actually wire in page.write? in the filter code, since it was written to always return true it appears to have also been optimized to not even be called.)

The result: I can now put target: onion in the front patter of a post or other page and on a default site generation, it will not be included. Then add target: onion to my _config_onion.yml and do a second generation with it and the second site now has the onion targeted content!

Context

Just an idea I had

…ate multiple outputs from a single site codebase with various target site included files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant