inukshuk / jekyll-scholar

jekyll extensions for the blogging scholar
MIT License
1.12k stars 102 forks source link

Reference tags with links #336

Open mo-seph opened 2 years ago

mo-seph commented 2 years ago

I like to have some small lists of papers on my site - key works around a certain project. The {% reference ... %} style works fine, except that the rendered HTML does not link anywhere. Would it be possible to make it link to either the details page, or the paper's URL, or the PDF file? Ideally, styling these inline references in the same way at the bibliography items would be fantastic!

inukshuk commented 2 years ago

You can use custom templates to fully customize each reference. The template has access to the rendered reference string as well as individual fields (like a paper's URL) you can use to create links.

mo-seph commented 2 years ago

I can't make that do anything for {% reference $} tags - it works for a main bibliography, e.g.

{% bibliography --group_by year --group_order descending --template  inlinebib %}

But for inline references, this doesn't do anything:

{% reference author2020Title --template  inlinebib %}
inukshuk commented 2 years ago

Oh, yes, the reference tag itself is a lower-level tag (basically it renders the 'reference' which is exposed to the template in the bibliography tag). I think the idea here was that if you're already operating at the level of a single item, you can just work on the page itself where you're using this tag. For example, create a link for the same item with the detalis_link or cite_details tags. It might be useful to add a more abstract tag that exposes the full entry, but you can probably still work around this limitation by using bibliography tag with a query using your item's id.

{% bibliography --query @*[key=author2020Title] -T inlinebib %}

This would still create a list; if that's an issue you could configure both bibliography_list_tag and bibliography_item_tag to span for the page in question.

mo-seph commented 2 years ago

Ah, I think that would fit my use case fantastically! Can I put multiple keys in the key field? I'll have a play. Thank you!