Skip to content

Commit 37d75d0

Browse files
authored
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 <[email protected]>
1 parent 86a6b03 commit 37d75d0

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

_includes/citation.liquid

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<br>
2+
<hr>
3+
<br>
4+
5+
If you found this useful, please cite this as:
6+
7+
{% capture citation_quote -%}
8+
> {{ 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 }}.
9+
{%- endcapture %}
10+
{{ citation_quote | markdownify }}
11+
12+
<p>or as a BibTeX entry:</p>
13+
14+
{% capture citation_code -%}
15+
```bibtex
16+
@article{ {{- site.last_name | downcase }}{{ page.date | date: "%Y" }}{{ page.title | slugify }},
17+
title = { {{- page.title -}} },
18+
author = { {{- site.last_name }}, {{ site.first_name }}{% if site.middle_name %} {{ site.middle_name }}{% endif -%}},
19+
{%- if site.title != 'blank' %}journal = { {{- site.title -}} },{% endif %}
20+
year = { {{- page.date | date: "%Y" -}} },
21+
month = { {{- page.date | date: "%b" -}} },
22+
url = { {{- site.url }}{{ page.url -}} }
23+
}
24+
```
25+
{%- endcapture %}
26+
{{ citation_code | markdownify }}

_layouts/post.liquid

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ layout: default
6969
</div>
7070
</article>
7171

72+
{% if page.citation %}
73+
{% include citation.liquid %}
74+
{% endif %}
75+
7276
{% if page.related_publications %}
7377
<h2>References</h2>
7478
<div class="publications">

_posts/2024-04-28-post-citation.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
layout: post
3+
title: a post that can be cited
4+
date: 2024-04-28 15:06:00
5+
description: this is what a post that can be cited looks like
6+
tags: formatting citation
7+
categories: sample-posts
8+
citation: true
9+
---
10+
11+
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`.

0 commit comments

Comments
 (0)