-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathcontent_filelinks.html
More file actions
44 lines (43 loc) · 5.78 KB
/
content_filelinks.html
File metadata and controls
44 lines (43 loc) · 5.78 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
<div class="content_links">{% if page.collection == "content" and page.external_url %}{% if page.external_url contains "archive.org" and page.category == "monographs" and page.external_url contains "/mode/" %}Read it:{% elsif page.subcat == "podcast" %}Listen:{% elsif page.subcat == "film" or page.subcat == "course" and page.external_url contains "youtu" %}Watch:{% else %}Get it:{% endif %}{% elsif page.collection == "content" and page.drive_links.size > 0 %}Available as:{% endif %}
{% if include.content.external_url %}{% assign linkfmt = "" %}
{%- capture linkbody -%}<i class="fa{% if include.content.external_url contains "youtu" %}{% assign linkfmt = "YouTube (link)" %}b fa-youtube"></i> YouTube{% elsif include.content.external_url contains "//www.academia.edu/" %}c-academia"></i>cademia.edu{% assign linkfmt = "Academia.edu" %}{% else %}s fa-{% assign ext = include.content.external_url | slice: -4, 4 %}{% if ext == ".pdf" %}{% assign linkfmt = "pdf" %}file-pdf"></i> pdf{% elsif ext == ".mp3" %}{% assign linkfmt = "mp3" %}file-audio"></i> mp3{% elsif ext == ".zip" %}{% assign linkfmt = "zip" %}file-archive"></i> zip{% else %}{% if ext == ".htm" %}{% assign linkfmt = "html" %}{% elsif ext == "html" %}{% assign linkfmt = "html" %}{% endif %}{% case include.content.category %}{% when "av" %}volume-up{% when "booklets" %}book-open{% when "monographs" %}book-open{% else %}globe{% endcase %}"></i> Online{% endif %}{% endif %}{%- endcapture -%}
<a class="btn" {% if include.newtab %}target="_blank"{% endif %} {% include content_link_data_attributes.html content=include.content linktype="Main External URL" linkfmt=linkfmt %} href="{{ include.content.external_url }}"{% for nrh in site.data.content.noreferrerhosts %}{% if include.content.external_url contains nrh %} rel="noreferrer"{% break %}{% endif %}{% endfor %}>{{ linkbody }}</a>
{% endif %}
{% if include.content.file_links.size > 0 %}
{%- for link in include.content.file_links -%}
{% assign linkfmt = include.content.formats[forloop.index0] %}
<a class="btn" {% if include.newtab %}target="_blank"{% endif %} {% include content_link_data_attributes.html content=include.content linktype="Self-Hosted" linkfmt=linkfmt %} href="{{ site.data.content.filehost | append: link }}"><i class="fa{% case linkfmt %}{% when "pdf" %}r fa-file-pdf{% when "jpeg" %}r fa-file-image{% when "mp3" %}r fa-file-audio{% when "m4a" %}r fa-file-audio{% when "epub" %}s fa-tablet-alt{% when "png" %}r fa-file-image{% when "mp3s" %}r fa-file-open{% when "zip" %}r fa-file-archive{% when "pdfs" %}r fa-file-open{% when "wma" %}r fa-file-audio{% else %}r fa-file{% endcase %}"></i> {{ linkfmt }}</a>
{%- endfor -%}
{%- endif -%}
{%- if include.content.drive_links.size > 0 -%}
{%- for link in include.content.drive_links -%}
{% assign linkfmt = include.content.formats[forloop.index0] %}
<a class="btn" {% if include.newtab %}target="_blank" {% endif %}{% include content_link_data_attributes.html content=include.content linktype="Google Drive" linkfmt=linkfmt %} href="{{ link }}"><i class="fa{% if link contains "drive.google.com" %}b fa-google-drive{% elsif link contains "play.google.com" %}b fa-google-play{% elsif link contains "obu.pages.dev" %}s fa-cloud-arrow-down{% else %}s fa-globe{% endif %}"></i> {{ linkfmt }}</a>
{%- endfor -%}
{%- endif -%}
{% if page.source_url %}
<a class="btn" href="{{ include.content.source_url }}" {% if include.newtab %}target="_blank"{% endif %} {% include content_link_data_attributes.html content=include.content linktype="Source" linkfmt="" %}><i class="fas fa-route"></i> Origin</a>
{% endif %}
{%- assign showworldcat = false -%}
{%- unless include.content.source_url or include.content.external_url or include.content.file_links or include.content.drive_links.size > 0 -%}
{%- if include.newtab -%}
{%- unless include.content.excerpt_url -%}[recommended but under copyright]{%- endunless -%}
{%- else -%}
{%- assign showworldcat = true -%}
{%- endif -%}
{%- endunless -%}
{%- if include.content.excerpt_url -%}
{%- if showworldcat -%}<details class="copyright details-reset"><summary>{%- endif -%}
<a class="btn" {% if include.newtab %}target="_blank" {% endif %}href="{{ include.content.excerpt_url }}" {% include content_link_data_attributes.html content=include.content linktype="Preview" linkfmt="html" %}><i class="fas fa-book-reader"></i> Preview</a>
{%- endif -%}
{%- if showworldcat -%}
{%- unless include.content.excerpt_url -%}<details class="copyright details-reset"><summary>{%- endunless -%}
{%- capture authors -%}{% include content_authors_string.html content=include.content %}{%- endcapture -%}
{% assign authors = authors | strip_html | strip | cgi_escape %}
<a class="btn" {% include content_link_data_attributes.html content=include.content linktype="WorldCat" linkfmt="WorldCat" %} href="https://www.worldcat.org/{% if include.content.oclc %}oclc/{{ include.content.oclc }}{% else %}search?q=ti%3A{{ include.content.title | markdownify | strip_html | strip | cgi_escape }}{% if authors %}+au%3A{{ authors }}{% endif %}{% if include.content.category == 'monographs' %}&fq=x0%3Abook+%3E+ln%3Aeng{% endif %}&qt=advanced{% endif %}"><i class="fas fa-binoculars"></i> WorldCat™</a>
<i class="far fa-question-circle"></i>
</summary><div>
<i class="far fa-copyright"></i> This fine, Copyrighted work cannot be shared {% if include.content.excerpt_url %}in its entirety{% else %}directly{% endif %}, however WorldCat™ can help you find a copy at a nearby library{% if include.content.category == 'monographs' %} or wherever you get books{% endif %}.
</div></details>
{%- endif -%}
</div>