Replies: 3 comments
-
@maximevaillancourt I've been reading the Jekyll docs, and the original issue I seem to have resolved using a hook. My modified version of the plugin looks like this, and so far it is working for my
By hooking the plugin to the HOWEVER! This does not work for my posts directory, for some inexplicable reason. If I try to add a post in |
Beta Was this translation helpful? Give feedback.
-
Additional context, in my config, I define my collections like so:
|
Beta Was this translation helpful? Give feedback.
-
Update here in case anyone reads this thread: still haven't solved this problem, but I'm trying a new solution. No longer using the collections above, since I was worried about collision between
I've also cut out a bunch of extra logic from the plugin to help with troubleshooting. I'm using an edited version of TerminalAddict's refactor from the Jekyll forum. Mine looks like this:
I describe my approach and issues in more detail here: https://talk.jekyllrb.com/t/trouble-with-hooks-for-a-custom-backlink-generator/9945/8. Long story short, This works for pages only (can't figure out how to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Another thread for a different issue I'm having, also with the site I'm building at https://github.com/steinea/garden. As noted previously, I'm trying to get this theme to work with an existing site that has quite a lot of content. I heavily rely on Jekyll's ability to run through a set of posts or pages and generate lists or tables based on categories or tags in the front matter.
My site has a slightly different structure than the default site for this template, with two different collections of file types. Maxime's
bidirectional_links_generator.rb
was clear and easy to parse, and I was able to tweak it to work for my two collections instead of the one_notes
collection. With the tweaked plugin, links written directly in post or page content generate backlinks appropriately, and the notes graph likewise displays these links. See the modified plugin here: https://github.com/steinea/garden/blob/main/_plugins/bidirectional_links_generator.rb.However, I've noticed that links generated by a
{% for %}
loop do not generate backlinks, nor do the links appear in the notes graph. For instance, see https://github.com/steinea/garden/blob/main/collections/_pages/activity.html:This hard-coded link generates a backlink and notes graph connection. But on the same page, this code...
...which generates the same link, does not generate a backlink nor a notes graph connection. If I inspect the page source, both links are being rendered by Jekyll identically in html. So I think it must be the order of operations between the plugin and the for loop that is causing the problem? If the plugin runs first in the build sequence, it will only find the hard-coded link. Then if the for loop runs second, the link will be generated after the plugin has run. So if there is no hard-coded link, then the plugin will find no link at all, even if that link is generated after the fact by the for loop. This is my suspicion as to what's the issue is, but unfortunately I don't know how to resolve it if true. Help? Ty!
Beta Was this translation helpful? Give feedback.
All reactions