💾 Archived View for gem.lizsugar.me › 2023 › 07 › 15 › jekyll-gemini-and-generators.gmi captured on 2024-02-05 at 09:31:01. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

➡️ Next capture (2024-03-21)

-=-=-=-=-=-=-

Jekyll-Gemini and Generators

2023-07-15 | #jekyll #gemini #programming

Per the jekyll-gemini readme,

## To do
1. Add RSS/Atom generation - this seems common in Geminispace, currently generators are just disabled when building the Capsule

Which is seen in line 9 of `capsule.rb`:

self.generators = []

Simply commenting this line out runs any generators you have set up in jekyll. For me, this is three specific plugins:

, and they each fail in their own unique ways.

jekyll-feed

Jekyll-Gemini barfs on this because it's not a gemini file and it doesn't know how to ignore it. By default, jekyll-gemini ignores anything that is not a .gmi file. But that only seems to be true in the root directory and the `_posts` directory. But you'll find that running `bundle exec jekyll gemini --verbose` shows that feed.xml is indeed in the root dir:

         Rendering: feed.xml
                    -------------------------------------------------
      Jekyll 4.3.2   Please append `--trace` to the `gemini` command
                     for any additional information or backtrace.
                    -------------------------------------------------
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.3.2/lib/jekyll/renderer.rb:228:in `assign_highlighter_options!': undefined method `highlighter_prefix' for nil:NilClass (NoMethodError)

      payload["highlighter_prefix"] = converters.first.highlighter_prefix
                                                      ^^^^^^^^^^^^^^^^^^^
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.3.2/lib/jekyll/renderer.rb:57:in `run'

And to that I say: iunno 🤷‍♀️

jekyll-paginate

This one specifically looks to operate on index.html, as seen in the warning it gives during site creation:

Pagination: Pagination is enabled, but I couldn't find an index.html page to use as the pagination template. Skipping pagination.

Line 39 of `pager.rb` explicitly looks for index.html:

page.name == 'index.html' &&

Changing that to

page.name == 'index.gmi' &&

works perfectly. Only for the gemini capsule though, as now it will not generate pagination for my web version.

What is the correct way to make this work with multiple index files of different extensions? This is an actual question. I don't know where to begin with this.

jekyll-archives

This plugin is just like the last one. You go into `archive.rb` and change

path = File.join(path, "index.html") if url =~ %r!\/$!

to

path = File.join(path, "index.gmi") if url =~ %r!\/$!

and it generates the archives pages perfectly.

As above: what is the correct way to make this work with multiple output formats?

What's next?

Is this a jekyll-gemini plugin issue, or is this an issue with the plugins above? Does jekyll-gemini need to call these generators in some specific way or pass specific information to them?

I cannot just arbitrarily modify individual lines of these plugins - well, yes I could actually just arbitrarily modify individual lines, but they will both break on my web build and revert whenever any updates come in for them.

Honestly, I have no idea where to go from here. I don't like that jekyll-gemini hasn't been touched in two and a half years, so I want to do something to improve the project, but I do not want to become the new maintainer of it like I almost did with a different abandoned project I worked on for Home Assistant.

I do sometimes wonder if jekyll is even the tool I should be using anymore, but I do quite like it, and these are honestly pretty minor issues.

Workarounds

jekyll-feed

Actually, this one isn't even necessary, since it seems the gemlog format is pretty standard for feeds instead of RSS or Atom. Nothing to do here. But I can see a reason someone else might want this to work for their own capsule.

jekyll-paginate

Well, for one, I'm just not listing every single post on my capsule index anymore. It's limited to four, and if you wanna see more, click through to my gemlog. Easy peasy, and it keeps my index simple. Again though, there is a use case for this and it'd be great if it worked.

jekyll-archives

I want this to work so I can generate archives by post tag. Such that you'd be able to go to /tags/releases/ to get a page that lists only my posts tagged as game releases. On my website I don't even use this plugin though, just some really basic javascript that shows and hides post lists based on the anchor supplied in the URL (if the javascript is not loaded, it falls back to nearly the same layout as what I'm currently using to show posts by tags in gemini)

https://lizsugar.me/tags

gemini://gem.lizsugar.me/tags

---

View this page on web