Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backlinks? #344

Open
sneakers-the-rat opened this issue Jul 11, 2022 · 1 comment
Open

Backlinks? #344

sneakers-the-rat opened this issue Jul 11, 2022 · 1 comment

Comments

@sneakers-the-rat
Copy link

Hello again!

I'd love to add support for backlinks - after the reference in the bibliography, links back to the in-text citations. I think it should be relatively straightforward:

  • add id anchors to the in-text citation links
    • ideal but optional - this would have some configurable prefix, or be able to use liquid/etc. to be able to make some custom ID. Not sure what metadata is available at the time the in-text citation links are generated.
    • Otherwise something like {{ citation.id }}:{{ n_usage }}
  • add links after references back to all id anchors
    • ideal but optional - being able to make use of section numbering so backlinks can be back to "2.3"
    • Otherwise just 1, 2, 3

Normally i'd just dig my way through the code and figure out how to do this myself, but am sort of on a tight timeline. I'd be happy to draft it, but it would be helpful to have some pointers where I might go to do this.

Thanks again for your work on this plugin!!!!

@inukshuk
Copy link
Owner

Good idea!

The in-text citation links are created around here. If I'm not mistaken you can just add additional attributes there at the end, besides the class attribute. I guess the most tricky question here is how to deal with references that are cited multiple times. The cited keys themselves are tracked in the render_citation helper and we could probably re-purpose this a to also keep track of the number of citations.

When rendering the bibliography, the links to the details pages are ]optionally added to each reference](https://github.com/inukshuk/jekyll-scholar/blob/master/lib/jekyll/scholar/tags/bibliography.rb#L64). I'd guess that's where we'd want to insert the backlinks. All the helpers from the utilities module are available in the tag here. So I'd suggest to add a helper that creates the backlink id for an entry's id plus the usage count (and optionally a configurable prefix as you suggest).

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

No branches or pull requests

2 participants