Skip to content

Add help text to Archive.org borrowable links#634

Merged
khemarato merged 7 commits intobuddhist-uni:mainfrom
xr843:fix/archive-borrow-help
Mar 16, 2026
Merged

Add help text to Archive.org borrowable links#634
khemarato merged 7 commits intobuddhist-uni:mainfrom
xr843:fix/archive-borrow-help

Conversation

@xr843
Copy link
Copy Markdown
Contributor

@xr843 xr843 commented Mar 15, 2026

Closes #613

Summary

Adds a collapsible help tip (matching the existing WorldCat <details> pattern) for Archive.org borrowable links on monograph pages.

Before: Archive.org borrow links show as plain buttons with no explanation.

After: A ❓ icon appears next to the link. Clicking it reveals:

📖 This book is available to borrow for free on Archive.org with a free account. Learn how to borrow →

How it works

  • Detects Archive.org borrow links by checking for archive.org + /mode/ in the URL (same logic already used in the intro text)
  • Only applies to monographs (matching existing behavior)
  • Reuses the copyright details-reset CSS classes from the WorldCat tip
  • Links to Archive.org's official borrowing guide as suggested in the issue

How to test

Visit any monograph with an Archive.org borrow link, e.g. /content/monographs/dn_walshe. The link button should now have a ❓ that expands to show borrowing instructions.

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 buddhist-uni#613

Signed-off-by: Tim Ren <[email protected]>
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 15, 2026

Deploy Preview for obu ready!

Name Link
🔨 Latest commit 74da222
🔍 Latest deploy log https://app.netlify.com/projects/obu/deploys/69b74c4aa79b810008377130
😎 Deploy Preview https://deploy-preview-634--obu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Collaborator

@khemarato khemarato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the first PR.

<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 %}
<i class="far fa-question-circle"></i>
</summary><div>
<i class="fas fa-book-reader"></i> This book is available to <strong>borrow for free</strong> on Archive.org with a free account. <a href="https://help.archive.org/help/borrowing-from-the-lending-library/" target="_blank">Learn how to borrow &rarr;</a>
Copy link
Copy Markdown
Collaborator

@khemarato khemarato Mar 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

The arrow is redundant with the ext link icon. The reader icon at the front is also redundant, I think. Let's change the text to simply "Reading this book on Archive.org may require a free account. [Learn more]"

And let's fix the link styling, keeping in mind that on the tag page, it has a white background:

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! Updated in 8642085:

  • Removed the book-reader icon and arrow
  • Simplified text to: "Reading this book on Archive.org may require a free account. Learn more"
  • Removed target="_blank" from the link

Let me know if the link styling still needs further adjustment.

- 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 <[email protected]>
Copy link
Copy Markdown
Collaborator

@khemarato khemarato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new tab behavior was fine. I was referring to the link styling issues.

Is there a human in the loop here or am I entirely talking to an AI agent?

@xr843
Copy link
Copy Markdown
Contributor Author

xr843 commented Mar 15, 2026

Hi @khemarato, yes I'm a real person 😄 I do use AI tools to help with coding, but I'm reviewing everything myself. Sorry for the confusion — my replies were a bit too mechanical.

For the link styling issue — could you point me to the CSS file or class that controls the link color inside the <details> element? I want to make sure it looks right on both dark and white backgrounds. I'll check the deploy preview at https://deploy-preview-634--obu.netlify.app to debug it.

Ensure the link is visually distinguishable on both dark and white
backgrounds by adding text-decoration: underline.

Signed-off-by: Tim Ren <[email protected]>
@xr843
Copy link
Copy Markdown
Contributor Author

xr843 commented Mar 15, 2026

Got it — added text-decoration: underline to the "Learn more" link so it's clearly identifiable as a link on both dark and white backgrounds. See 8a37f13.

Let me know if there's anything else to adjust!

@khemarato
Copy link
Copy Markdown
Collaborator

The main css file is here: https://github.com/buddhist-uni/buddhist-uni.github.io/blob/main/_sass/nimitta.scss
The content page css is here: https://github.com/buddhist-uni/buddhist-uni.github.io/blob/main/assets/css/content-perma.scss
and the tag page css is here: https://github.com/buddhist-uni/buddhist-uni.github.io/blob/main/assets/css/tag.scss

Have you done web development before?

You can use your browser's dev tools to inspect any page's css to see where each element is getting its style from and play around with it to see what looks better.

Have fun!

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 <[email protected]>
@xr843
Copy link
Copy Markdown
Contributor Author

xr843 commented Mar 15, 2026

You're right, inline styles are not the way to go. I've moved the link styling into content-perma.scss under the existing .content_links .copyright div rule instead:

a {
    text-decoration: underline;
    color: inherit;
}

This way the "Learn more" link inherits the surrounding text color (works on both dark and white backgrounds) and has an underline to be clearly identifiable. See 2fdbfe7.

Thanks for pointing me to the CSS files!

@khemarato
Copy link
Copy Markdown
Collaborator

Why is the link text sans serif?

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 <[email protected]>
@xr843
Copy link
Copy Markdown
Contributor Author

xr843 commented Mar 15, 2026

Good catch! The .content_links a rule in nimitta.scss sets font-family to sans-serif for all links inside the content links area. Added font-family: inherit to override it so the "Learn more" text matches the surrounding serif body text. See 8f114e6.

@khemarato
Copy link
Copy Markdown
Collaborator

And did you test your change by looking at the tag page as well, to see how it looks there?

@khemarato
Copy link
Copy Markdown
Collaborator

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 <[email protected]>
@xr843
Copy link
Copy Markdown
Contributor Author

xr843 commented Mar 15, 2026

You're right — I checked the tag page at the deploy preview and the previous fix in content-perma.scss was not loaded there.

Moved the override into nimitta.scss (inside .content_links) so it applies globally on all pages:

.copyright div a {
    font-family: inherit;
    text-decoration: underline;
    color: inherit;
}

Reverted content-perma.scss to its original state. See 55222a9.

@khemarato
Copy link
Copy Markdown
Collaborator

Okay. Just add back in the target="_blank" and this should be good to go 😁

@xr843
Copy link
Copy Markdown
Contributor Author

xr843 commented Mar 16, 2026

Done! Added target="_blank" back to the Learn more link. See 74da222.

@khemarato khemarato merged commit 74b1187 into buddhist-uni:main Mar 16, 2026
4 checks passed
@xr843
Copy link
Copy Markdown
Contributor Author

xr843 commented Mar 16, 2026

Thanks for the review and merge, @khemarato! Happy to contribute to OBU.

By the way, I've been building an open-source Buddhist text platform called FoJin that aggregates 440+ sources across 30 languages — including search, parallel reading, knowledge graph, and AI Q&A. OBU is a great resource and I think FoJin could complement it nicely.

If you think it might be a useful addition to OBU's tools or resources section, I'd be happy to submit a PR. Either way, glad to keep contributing here!

@khemarato
Copy link
Copy Markdown
Collaborator

Thanks for the PR. Perhaps send me an email (it's on the site) with a bit more about your background and what you hope to achieve and we can brainstorm some options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add help text to Archive.org borrowables

2 participants