Skip to content

Commit 74b1187

Browse files
authored
Add help text to Archive.org borrowable links (#634)
* Add help text to Archive.org borrowable links Add a collapsible help tip (similar to the existing WorldCat tip) for Archive.org links that are borrowables (identified by /mode/ in URL). The tip explains that the book can be borrowed for free and links to Archive.org's official borrowing guide. Fixes #613 Signed-off-by: Tim Ren <137012659+xr843@users.noreply.github.com> * Simplify Archive.org help text per review feedback - Remove redundant book-reader icon and arrow from help text - Simplify wording to: "Reading this book on Archive.org may require a free account. Learn more" - Remove target="_blank" from learn more link for consistency Signed-off-by: Tim Ren <137012659+xr843@users.noreply.github.com> * Fix link styling: add underline to Learn more link Ensure the link is visually distinguishable on both dark and white backgrounds by adding text-decoration: underline. Signed-off-by: Tim Ren <137012659+xr843@users.noreply.github.com> * Fix link styling via SCSS instead of inline style Move link underline styling from inline style to the existing .content_links .copyright div rule in content-perma.scss. Use color: inherit so the link matches surrounding text on both dark and white backgrounds. Signed-off-by: Tim Ren <137012659+xr843@users.noreply.github.com> * Fix font-family: inherit serif font for help text link The .content_links a rule sets sans-serif font-family globally. Override with font-family: inherit so the Learn more link matches the surrounding serif body text. Signed-off-by: Tim Ren <137012659+xr843@users.noreply.github.com> * Move link styling to nimitta.scss for global coverage The previous fix in content-perma.scss only applied to content pages, not tag pages. Move the .copyright div a override into nimitta.scss (inside .content_links) so it applies everywhere. Revert content-perma.scss to its original state. Signed-off-by: Tim Ren <137012659+xr843@users.noreply.github.com> * Add target=_blank back to Learn more link Signed-off-by: Tim Ren <137012659+xr843@users.noreply.github.com> --------- Signed-off-by: Tim Ren <137012659+xr843@users.noreply.github.com>
1 parent 66e4bc4 commit 74b1187

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎_includes/content_filelinks.html‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
<div class="the-links">
33
{% if include.content.external_url %}{% assign linkfmt = "" %}
44
{%- 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 == ".mp3" %}{% assign linkfmt = "mp3" %}file-audio"></i> mp3{% elsif ext == ".zip" %}{% assign linkfmt = "zip" %}file-archive"></i> zip{% elsif ext == "epub" %}{% assign linkfmt = "epub" %}tablet-screen-button"></i> epub{% elsif ext == ".htm" or ext == "html" %}{% assign linkfmt = "html" %}globe"></i> Online{% elsif include.content.external_url contains "download" or include.content.external_url contains "viewcontent.cgi" or include.content.external_url contains "pdf" %}{% assign linkfmt = "pdf" %}file-pdf"></i> pdf{% else %}{% case include.content.category %}{% when "av" %}{% if page.subcat == "film" %}video{% else %}volume-up{% endif %}{% when "booklets" %}book-open{% when "monographs" %}book-open{% else %}globe{% endcase %}"></i> Online{% endif %}{% endif %}{%- endcapture -%}
5-
<div class="a-link"><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></div>
5+
{%- assign is_archive_borrow = false -%}
6+
{%- if include.content.external_url contains "archive.org" and include.content.external_url contains "/mode/" and include.content.category == "monographs" -%}
7+
{%- assign is_archive_borrow = true -%}
8+
{%- endif -%}
9+
<div class="a-link">{% if is_archive_borrow %}<details class="copyright details-reset"><summary>{% endif %}<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>{% if is_archive_borrow %}
10+
<i class="far fa-question-circle"></i>
11+
</summary><div>
12+
Reading this book on Archive.org may require a free account. <a href="https://help.archive.org/help/borrowing-from-the-lending-library/" target="_blank">Learn more</a>
13+
</div></details>{% endif %}</div>
614
{% endif %}
715
{%- if include.content.drive_links.size > 0 -%}
816
{%- for link in include.content.drive_links -%}
@@ -44,4 +52,4 @@
4452
</div></details></div>
4553
{%- endif -%}
4654
</div>
47-
</div>
55+
</div>

‎_sass/nimitta.scss‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,11 @@ h1.overlay-into-banner {
540540
a {
541541
font-family: $ui-font-family;
542542
}
543+
.copyright div a {
544+
font-family: inherit;
545+
text-decoration: underline;
546+
color: inherit;
547+
}
543548
}
544549

545550
main header.post-header {
@@ -636,4 +641,4 @@ ol {
636641
font-size: 14px;
637642
}
638643
}
639-
}
644+
}

‎assets/css/content-perma.scss‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,4 @@ div.similar_content_footer {
162162
padding-bottom: 8px;
163163
}
164164
}
165-
}
166-
167-
165+
}

0 commit comments

Comments
 (0)