-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathcontent.html
More file actions
164 lines (151 loc) · 10.1 KB
/
content.html
File metadata and controls
164 lines (151 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
layout: default
---
{%- comment -%}Populate tags: an array of a-tags linking to the topical tags{%- endcomment -%}
{%- assign tagslugs = page.tags -%}
{%- if page.course -%}
{%- assign tagslugs = tagslugs | unshift: page.course -%}
{%- endif -%}
{%- assign tags = '' | split: '' -%}
{%- for t in tagslugs -%}
{%- assign tag = site.tags | where: "status", "published" | find: "slug", t -%}
{%- if tag -%}
{%- capture taglink -%}<a class="TagLabel" href="{{ tag.url }}"><i class="fas fa-tag"></i> {{ tag.title }}</a>{%- endcapture -%}
{%- assign tags = tags | push: taglink -%}
{%- endif -%}
{%- endfor -%}
{%- if tags.size == 0 -%}{%- assign tags = nil -%}{%- endif -%}
{%- assign category = site.categories | find: "slug", page.category -%}
<article class="content-perma">
<header class="post-header" style="margin-bottom: 12px;"><div>
<script>window.topic_category="{{ page.course | default: 'archive' }}";</script>
<div class="back"><a href="/content/">Content</a> / <a href="/content/{{ page.category }}/">{{ category.title }}</a> /</div>
{%- if page.olid -%}
<img src="https://buddhistuniversity.net/assets/imgs/covers/{{ page.olid }}.jpg" alt="the book cover">
{%- elsif page.image -%}
<img src="{{page.image}}">
{%- elsif page.category == "av" and page.external_url contains "youtu" -%}
{%- comment -%}Don't add an img on top if there will be a YouTube player below{%- endcomment -%}
{%- elsif page.drive_links[0] -%}{%- if 'pdf,mp4' contains page.formats[0] -%}
{%- assign dlink = page.drive_links[0] | split: "/" -%}
{%- assign dlink = dlink[5] -%}
{%- if dlink.size == 28 or dlink.size == 33 or dlink.size == 44 -%}
<img src="https://drive.google.com/thumbnail?authuser=0&sz=h500&id={{ dlink }}" onerror="this.remove()">
{%- endif -%}{%- endif -%}{%- endif -%}
</div><div class="content-information">
{% assign title = page.title | markdownify | remove: '<p>' | remove: '</p>' | split: ": " %}
<h1 class="post-title">{% if page.subcat %}{% include content_icon.html category=page.category subcat=page.subcat %} {% endif %}{{ title | first }}
{%- if title.size > 1 -%}<span style="color:transparent">: </span><div class="post-subtitle">{{ title | shift | join: ": " }}</div>{%- endif -%}</h1>
{% if page.authors.size > 0 %}<h2 class="author">
By {% include_cached content_authors_string.html content=page hide_reader=true link=true %}
</h2>{% endif %}
{% if page.reader %}
{% if page.reader contains " " %}{% assign reader = nil %}{% else %}{% assign reader = site.authors | find: "slug", page.reader %}{% endif %}
<h2 class="author">Read by {% if reader %}<a href="{{ reader.url }}">{{ reader.title }}</a>{% else %}{{ page.reader }}{% endif %}</h2>
{% endif %}
{% unless page.reader or page.authors.size > 0 %}<div class="mb-3"></div>{% endunless %}
{% unless page.stars == 3 %}<div class="content_rating">
<details class="details-reset">
<summary class="RatingLabel-{{ page.stars }}">{% include starlabel.html stars=page.stars %}</summary>
<div class="RatingDetails">{% if page.stars == 1 %}
This work is no longer recommended{% if page.reason %}, because: <code>{{ page.reason }}</code>{% endif %}. Look below for possible alternatives.
{% elsif page.stars == 2 %}This work is only recommended for those with a special interest.
{% elsif page.stars == 5 %}was featured in the <a href="{{ page.featured_post.url }}">{{ page.featured_post.date | date: "%B %Y" }} newsletter</a> and is highly recommended for all.{% else %}
This is a piece of exceptional quality, recommended for everyone.
{% endif %}</div>
</details>
</div>{% endunless %}
<div class="download-info">
{% include content_filelinks.html content=page %}
<div>{% include content_size.html content=page %}</div>
</div>
</div>
</header>
<div class="post-content">
{% if page.category == "av" and page.external_url contains "youtu" or page.file_links[0] or page.embedded_html %}{% unless page.external_url contains "list" %}
{% include inline-av-player.html content=page %}
{% endunless %}{% endif %}
{{ content }}
</div>
<footer>
{%- assign booktitle = page.booktitle -%}
{%- if page.from_book -%}
{%- assign fbook = site.content | where: "slug", page.from_book | where: "category", "monographs" | first -%}
{%- if fbook -%}
{% capture booktitle %}<a href="{{ fbook.url }}">{{ fbook.title }}</a>{% endcapture %}
{%- endif -%}
{%- endif -%}
{% if page.series %}{% assign series = site.series | find: "slug", page.series %}{% else %}{% assign series = nil %}{% endif %}
{% if page.journal %}{% assign journal = site.journals | find: "slug", page.journal %}{% endif %}
{% if page.publisher or series or journal %}{% assign publisher = page.publisher | default: series.publisher | default: journal.publisher %}{% assign publisher = site.publishers | find: "slug", publisher | default: publisher %}{% else %}{% assign publisher = nil %}{% endif %}
{% if tags.size > 0 %}<p class="star_desc">
About: {{ tags }}
</p>{% endif %}
{%- if page.category == "monographs" -%}
{% assign pieces = site.content | where: "from_book", page.slug | sort: "pages" | sort: "chapter", "first" %}
{% if pieces.size > 0 %}<p class="pieces_desc">
Part{% if pieces.size > 1 %}s{% endif %} of this book {% if pieces.size > 1 %}are{% else %}is{% endif %} also in the library as: <ul>{% for c in pieces %}
<li>{% include simple_content.html content=c %}</li>
{% endfor %}</ul></p>{% endif %}
{%- endif -%}
{% if page.status != "rejected" and page.course %}
{% assign course = site.courses | find: "slug", page.course %}
{% if course %}<p class="featured_desc">Featured in the course, "<a href="{{ course.url }}#{{ page.slug }}"><i class="{{ course.icon }}"></i> {{ course.title }}</a>."
</p>{% endif %}
{% endif %}
<p class="pub_desc"><i>
{%- if page.translator -%}Translated by {% assign translators = page.translator | split: " and " %}{% include_cached content_authors_string.html authors=translators link=true %}.{% endif %}
{% if page.year or publisher or booktitle or page.journal or page.series %}Published{% if page.year %} in {{ page.year }}{% endif %}{% if page.journal %} in {% if journal %}<a href="{{ journal.url }}">{{ journal.title }}</a>{% else %}{{ page.journal }}{% endif %}{% endif %}{% if booktitle %} in “{{ booktitle }}”{% endif %}{% if page.editor %} ({% assign editors = page.editor | split: " and " %}{% include_cached content_authors_string.html authors=editors link=true %} ed.){% endif %}{% if publisher %}{% unless journal %} by {% if publisher.title %}<a href="{{ publisher.url }}">{{ publisher.title }}</a>{% else %}{{ publisher }}{% endif %}{% if page.address or publisher.address or series.address %}, {{ page.address | default: series.address | default: journal.address | default: publisher.address }}{% endif %}{% endunless %}{% endif %}{% if page.series %} {% if page.number %}as{% else %}in{% endif %} {% if series %}<a href="{{ series.url }}">{{ series.title }}</a>{% else %}"{{ page.series }}"{% endif %}{% if page.number %} number {{ page.number }}{% endif %}{% endif %}.{% endif %}
</i></p>
{% if site.show_bibtex %}
<details class="details-reset bibtex">
<summary class="btn">Bibtex Data <span class="dropdown-caret"></span></summary>
<div>
{% capture bibtex %}{% include content.bibtex.liquid content=page %}{% endcapture %}
{% capture md %}```tex
{{ bibtex }}```{% endcapture %}{{ md | markdownify }}
<button class="btn copybutton" data-clipboard-text="{{ bibtex | replace: '"', "'" }}"><i class="fas fa-copy"></i> Copy to clipboard</button>
<script src="{{ "/assets/js/clipboard.js" | relative_url }}"></script>
<script>
var cb = new ClipboardJS('.copybutton');
cb.on('success', function(e){showTooltip(e.trigger,'Copied');});
cb.on('error', function(e){showTooltip(e.trigger,'Error');});
function clearTooltip(){this.setAttribute('class','btn copybutton');this.removeAttribute('aria-label');}
function showTooltip(elem,msg){elem.setAttribute('class','btn copybutton tooltipped tooltipped-n');elem.setAttribute('aria-label',msg); setTimeout(clearTooltip.bind(elem), 4000);}
</script>
<table id="metadata"><tbody>{% if site.show_timestamps %}
<tr><td>Added</td><td><span>{{ page.date | date_to_rfc822 }}</span></td></tr>
{% if page.last_modified_at > page.date %}<tr><td>Updated</td><td><span>{{ page.last_modified_at | date_to_rfc822 }}</span></td></tr>{% endif %}{% endif %}
<tr><td>Sorting Value</td><td><span>{{ page.expected_value }}</span></td></tr>
</tbody></table>
<script type="module">
function addDownloadCountRow(download_count) {
const table = document.getElementById("metadata");
const dcRow = table.insertRow();
const labelCell = dcRow.insertCell(0);
labelCell.appendChild(document.createTextNode("Download Count"));
const valueCell = dcRow.insertCell(1);
const value = document.createTextNode(download_count.toString());
const valueSpan = document.createElement('span');
valueSpan.appendChild(value);
valueCell.appendChild(valueSpan);
}
const download_count_resp = await fetch("https://buddhistuniversity.net/analytics/content/{{ page.content_path }}.download_count");
var download_count = 0;
if (download_count_resp.ok) {
download_count = await download_count_resp.text();
download_count = Number.parseInt(download_count);
}
{% if page.external_url or page.drive_links.size > 0 %}
download_count++;{% endif %}
addDownloadCountRow(download_count);
</script>
<span><a href="https://github.com/{{ site.github_repo }}/blob/{{ site.github_branch }}/{{ page.path }}">View this entry's source code on GitHub</a></span>
</div>
</details>{% endif %}
{% if site.show_similars %}
{% assign include_content = page %}
{% similar_content %}
{% endif %}
</footer>
</article>