🔧 Complete Guide: Replace “Online resources: Click here to access online” with “🌐 Access Online” in Koha 25.11 (Full Code Included)
If you're customizing your Koha OPAC and want a cleaner, modern interface, one common improvement is replacing the default text:
Online resources: Click here to access online
with a simple, user-friendly button:
🌐 Access Online
This guide provides a complete working solution for Koha 25.11, including full XSLT code you can directly use.
🎯 What You Will Achieve
✔ Remove default repetitive text
✔ Show a clean 🌐 Access Online button
✔ Avoid duplication
✔ Keep Koha structure intact
📍 Where to Apply This
You need to edit:
MARC21slim2OPACResults.xsl
Path:
opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
👉 OR (if active):
System Preference → OPACXSLTResultsDisplay
⚠️ IMPORTANT BEFORE YOU START
Check:
👉 System Preference
OPACXSLTResultsDisplay
If NOT EMPTY → edit code there
If EMPTY → edit file
🧩 COMPLETE WORKING CODE (ITEM TYPE + ONLINE BUTTON)
👉 Paste this in place of your existing 942 + 856 display block
<!-- ================= ITEM TYPE DISPLAY START ================= -->
<xsl:variable name="itype" select="normalize-space(marc:datafield[@tag='942']/marc:subfield[@code='c'])"/>
<span class="itemtype-label" style="font-weight:bold;">
<xsl:choose>
<!-- E-BOOK -->
<xsl:when test="$itype='EBK' or $itype='EBOOK' or $itype='Ebooks' or $itype='E-Book'">
📱 E-Book
</xsl:when>
<!-- E-THESIS -->
<xsl:when test="$itype='ETHES' or $itype='E-Thesis'">
🎓💻 E-Thesis
</xsl:when>
<!-- THESIS -->
<xsl:when test="$itype='THES' or $itype='Thesis'">
🎓 Thesis
</xsl:when>
<!-- ARTICLE -->
<xsl:when test="$itype='AR' or $itype='Articles' or $itype='Article'">
📰 Article
</xsl:when>
<!-- MANUSCRIPT -->
<xsl:when test="$itype='MAN' or $itype='Manuscript'">
📜 Manuscript
</xsl:when>
<!-- BOOK -->
<xsl:when test="$itype='BK' or $itype='Books' or $itype='Book'">
📘 Book
</xsl:when>
<!-- PERIODICAL -->
<xsl:when test="$itype='SER' or $itype='Periodicals' or $itype='Periodical' or $itype='Serial'">
📖 Periodical
</xsl:when>
<!-- DEFAULT -->
<xsl:otherwise>
📂 Other
</xsl:otherwise>
</xsl:choose>
</span>
<!-- ================= ITEM TYPE DISPLAY END ================= -->
<!-- ================= ONLINE ACCESS (REPLACEMENT OF DEFAULT 856) ================= -->
<xsl:if test="marc:datafield[@tag=856]">
<span class="results_summary online_resources">
<xsl:for-each select="marc:datafield[@tag=856]">
<xsl:variable name="url" select="normalize-space(marc:subfield[@code='u'])"/>
<xsl:variable name="linktext" select="normalize-space(marc:subfield[@code='z'])"/>
<xsl:if test="$url != ''">
<a href="{$url}" target="_blank"
style="display:inline-block;
padding:5px 10px;
margin-top:4px;
background:#28a745;
color:#fff;
border-radius:5px;
text-decoration:none;
font-size:12px;">
<xsl:choose>
<!-- SMART LABELS -->
<xsl:when test="contains($url,'.pdf')">
📄 View PDF
</xsl:when>
<xsl:when test="contains($url,'youtube') or contains($url,'youtu.be')">
🎥 Watch Video
</xsl:when>
<!-- DEFAULT -->
<xsl:when test="$linktext != ''">
🌐 <xsl:value-of select="$linktext"/>
</xsl:when>
<xsl:otherwise>
🌐 Access Online
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:if>
</xsl:for-each>
</span>
</xsl:if>
<!-- ================= END ONLINE ACCESS ================= -->
🧹 IMPORTANT CLEANUP STEP
👉 You MUST remove the original default block:
Search and DELETE:
<span class="label">Online resources: </span>
<xsl:text>Click here to access online</xsl:text>
Otherwise duplication will remain.
🔄 APPLY CHANGES
Run:
sudo koha-plack --restart <your-instance>
sudo systemctl restart apache2
Then browser:
Ctrl + Shift + R
✅ FINAL RESULT
❌ Before:
Online resources: Click here to access online
✅ After:
🌐 Access Online
(or dynamic labels like 📄 View PDF / 🎥 Watch Video)
🚀 BONUS IMPROVEMENTS (Optional)
You can further enhance:
🎨 Bootstrap badges for item types
📂 Icons instead of emoji
📊 Show availability + online button in one row
🔍 Auto-detect DOI links
🎉 Conclusion
By replacing the default Koha 856 display instead of adding a new one, you:
✔ Eliminate duplication
✔ Improve user experience
✔ Modernize OPAC interface
If you want, I can help you:
👉 Align icons + buttons in one professional layout
👉 Add colors, hover effects, or tooltips
👉 Customize for thesis, PDFs, videos, etc.
Just let me know 👍