-
Notifications
You must be signed in to change notification settings - Fork 101
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
Access to BibTeX fields outside of details page layout? #329
Comments
Where exactly would you like to access the entry's fields? In order to load an entry you need to either cite it, generate a bibliography with it, or generate a detail page. So in general, the only places where there can be a reference to an entry would be the detail page or the reference template (unless I'm missing something). I think you could insert a given entry pretty much anywhere by using the |
Thanks for your feedback! To answer your question first: preferably anywhere on the website. On my website I basically aggregate quotes from academic writing, that are grouped together by subject (these are: the 'lemmas' in the 'lexicon', which each have an individual page in the website). Each quote needs a reference (for which I use Say, for example, that I have a
This is a simplified example, but I hope it gets the gist across: for different actions across my website, I need to access the fields of individual entries in my I like your suggestion of using
I checked, and changing the
If so, I just need to see if I can make my own simple custom CSLs files and I'm golden. Thanks again for your help! |
Instead of an ID you can also set the style to the absolute path to the (local) CSL style; using an URL as in your example should work as well (though using a local file might be best, so that you don't need to be online to generate the site). Anyway, so using a custom CSL style should work, but it might be complicated to get a good result. Instead, what I was suggesting is to use a custom bibliography template. You can override the template in the page's front-matter or using the
|
Ah yes -- I see how that might be much more convenient, thanks for the tip! I haven't really been able to get that to work yet, though. Maybe I'm still missing or misunderstanding something? I tested the following MWE: Given:A: the following
|
Hm, on a quick glance this looks good. Can you check the it works if you change the default |
Sure! With the same setup as before, but changing Just for the heck of it, I afterwards tried changing the What this tells me, is that |
Yes, that's right, my apologies for not thinking this through properly. The reference tag is actually one level deeper than the bibliography tag: the bibliography template even has access to the rendered reference -- so obviously this reference cannot, itself, be rendered using the template that depends on its rendition. That said, you could still achieve what you're looking for using the bibliography tag. It might even be more convenient this way if you're looking to render more than one entry: for example, in the sidebar you could render a bibliography, using the custom template, if there is a query you can use to select the entries in question our of your bib file. If there are only a handful of items, you could also construct the query using their keys. For example, this works:
The only downside here is that even if you select only a single item, you will always also get the bibliography container wrapped around it. Having said all that, it should be very easy to create a new tag which works sort of like we sketched out earlier: takes a single id and renders the bibliography template. |
Thank you! For individual references (or references that can be grouped together by a query) your suggestion works great! I tried it, and the fact that But sadly this approach doesn't really work for me for another reason: I would need to pass a variable through the
Which is probably impossible, because Liquid will always take the value of I think that therefore in my case the CSL-workaround may be the best fix for now. It's awfully hacky, but I think it should get the job done. And the added advantage would be that it would allow me to manipulate the output string in the same way that CSL does. So for example, the following code:
could be used to not only output Here, passing a variable inside the tag does work -- I have verified this. The only problem is that I haven't been able to get the CSL rendition to work yet (when I'm using my own). If I download a random CSL style like this one, called 'advanced materials' (saved as a
Jekyll gives me the following error:
The log printed below this error points to things like Do you know what could be the issue here? Thanks! |
The queries support liquid variable interpolation -- that's why you can select specific items by key in cases where there is no suitable query to select a specific group otherwise as I meant to show in the previous example. Using a custom CSL style you need to use the |
Thanks so much for your help! I ended up being able to solve all my issues with the
(FYI: you can see it in action here, in an So for my part, this issue is resolved and may be closed! Thanks again. Two points of feedback (that I'd be willing to do some more testing for if it's helpful): 1) I never did get the CSL solution to work.You were right of course that I should be using 2) It might be useful to also support liquid variable interpolation in the
|
This was super helpful, and answered my question "how do i make urls and DOIs into actual links" I think it would be lovely to add a mention to the bibliography templates section (https://github.com/inukshuk/jekyll-scholar#bibliography-template ) that you can also use the |
Hi everyone, I try get info from key with plugin jekyll scholar, but it's don't work for me |
Hi there!
First of all -- thanks for a great plugin! I am using it for a disciplinary lexicon website I'm building on GitHub, and it has been a great help to automatically reference all the academic output it aggregates.
I was wondering: is there a way for us to use Liquid to access the BibTeX fields anywhere outside of the details page layout file? Basically, I if I have a
bibliography.bib
file with the following entry:I want to be able to access
{{entry.author}}
. I imagine this would then probably outputFlanagan, David and Matsumoto, Yukihiro
. Even better would be if I could print that information already formatted according to my preferred citation style (e.g.:Flanagan, D. & Matsumoto, Y.
in the case ofstyle: apa
). But any way to access the field would already be a great help.Since that information is accessible in the details pages, my first thought was to try find a way to
{%for%}
-loop over thedetails_dir
, so I can access/details_dir/ruby.md
's{{page.entry.author}}
. But I don't see how I can access that directory (since it's only generated when I'm alreadyjekyll build
-ing).Thanks for your help!
All the best,
Wout
The text was updated successfully, but these errors were encountered: