From 37d75d039ee297ae2e02ac30bfbcdb738741b63d Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Mon, 29 Apr 2024 14:28:06 -0300 Subject: [PATCH] Added post citation (#2377) Basically adds suggestions of how to cite a post, as suggested in #2374. ![image](https://github.com/alshedivat/al-folio/assets/31376482/756eb88a-35c9-435a-b79e-70d11aa489cb) --------- Signed-off-by: George Araujo --- _includes/citation.liquid | 26 ++++++++++++++++++++++++++ _layouts/post.liquid | 4 ++++ _posts/2024-04-28-post-citation.md | 11 +++++++++++ 3 files changed, 41 insertions(+) create mode 100644 _includes/citation.liquid create mode 100644 _posts/2024-04-28-post-citation.md diff --git a/_includes/citation.liquid b/_includes/citation.liquid new file mode 100644 index 0000000..35bd9e3 --- /dev/null +++ b/_includes/citation.liquid @@ -0,0 +1,26 @@ +
+
+
+ +If you found this useful, please cite this as: + +{% capture citation_quote -%} +> {{ site.last_name }}, {{ site.first_name }}{% if site.middle_name %} {{ site.middle_name }}{% endif %} ({{ page.date | date: "%b %Y" }}). {{ page.title }}. {% if site.title != 'blank' %}{{ site.title }}. {% endif %}{{ site.url }}. +{%- endcapture %} +{{ citation_quote | markdownify }} + +

or as a BibTeX entry:

+ +{% capture citation_code -%} +```bibtex +@article{ {{- site.last_name | downcase }}{{ page.date | date: "%Y" }}{{ page.title | slugify }}, + title = { {{- page.title -}} }, + author = { {{- site.last_name }}, {{ site.first_name }}{% if site.middle_name %} {{ site.middle_name }}{% endif -%}}, + {%- if site.title != 'blank' %}journal = { {{- site.title -}} },{% endif %} + year = { {{- page.date | date: "%Y" -}} }, + month = { {{- page.date | date: "%b" -}} }, + url = { {{- site.url }}{{ page.url -}} } +} +``` +{%- endcapture %} +{{ citation_code | markdownify }} diff --git a/_layouts/post.liquid b/_layouts/post.liquid index 869d94c..ccb659c 100644 --- a/_layouts/post.liquid +++ b/_layouts/post.liquid @@ -69,6 +69,10 @@ layout: default + {% if page.citation %} + {% include citation.liquid %} + {% endif %} + {% if page.related_publications %}

References

diff --git a/_posts/2024-04-28-post-citation.md b/_posts/2024-04-28-post-citation.md new file mode 100644 index 0000000..4b47a27 --- /dev/null +++ b/_posts/2024-04-28-post-citation.md @@ -0,0 +1,11 @@ +--- +layout: post +title: a post that can be cited +date: 2024-04-28 15:06:00 +description: this is what a post that can be cited looks like +tags: formatting citation +categories: sample-posts +citation: true +--- + +This is an example post that can be cited. The content of the post ends here, while the citation information is automatically provided below. The only thing needed is for you to set the `citation` key in the front matter to `true`.