Showing posts with label data types. Show all posts
Showing posts with label data types. Show all posts

Monday, April 6, 2026

Enhancing Koha OPAC: Display Item Types with Icons (Koha 25.11 Guide)

Enhancing Koha OPAC: Display Item Types with Icons (Koha 25.11 Guide)

If you're using Koha 25.11 and want to improve your OPAC interface, one powerful customization is displaying item types (Book, Thesis, Article, etc.) with icons alongside each bibliographic record.

This improves usability and gives your OPAC a more modern, professional look.

In this guide, we’ll walk through a complete, working solution to achieve this.


🚀 Why Display Item Types?

By default, Koha OPAC may not clearly highlight the type of material in search results. Adding item types helps users quickly identify:

  • 📘 Books

  • 🎓 Theses

  • 📰 Articles

  • 📜 Manuscripts

  • 📖 Periodicals


🔍 Understanding the Data

Koha stores item types in two places:

  • Database (itemtypes table) → codes like BK, THES

  • MARC field 942$c → often contains descriptions like Books, Thesis

⚠️ Important:
XSLT reads MARC data, so you must match values like:

Books (not BK)

🛠️ Step 1: Add Icon Files

Create a folder for item type icons:

/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/images/itemtypes/

Add your icon images:

book.png
thesis.png
article.png
manuscript.png
periodical.png
default.png

🧩 Step 2: Modify XSLT File

Open the OPAC XSLT file:

/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl

Inside the template:

<xsl:template match="record">

Insert the following code where you want the item type to appear (usually near the title):

<!-- ===== ITEM TYPE WITH ICON START ===== -->

<xsl:variable name="itype" select="normalize-space(marc:datafield[@tag='942']/marc:subfield[@code='c'])"/>

<span class="itemtype-label">

    <xsl:choose>

        <xsl:when test="$itype='Books'">
            <img src="/opac-tmpl/bootstrap/images/itemtypes/book.png" class="itemtype-icon"/>
            Book
        </xsl:when>

        <xsl:when test="$itype='Thesis'">
            <img src="/opac-tmpl/bootstrap/images/itemtypes/thesis.png" class="itemtype-icon"/>
            Thesis
        </xsl:when>

        <xsl:when test="$itype='Articles'">
            <img src="/opac-tmpl/bootstrap/images/itemtypes/article.png" class="itemtype-icon"/>
            Article
        </xsl:when>

        <xsl:when test="$itype='Manuscript'">
            <img src="/opac-tmpl/bootstrap/images/itemtypes/manuscript.png" class="itemtype-icon"/>
            Manuscript
        </xsl:when>

        <xsl:when test="$itype='Periodicals'">
            <img src="/opac-tmpl/bootstrap/images/itemtypes/periodical.png" class="itemtype-icon"/>
            Periodical
        </xsl:when>

        <xsl:otherwise>
            <img src="/opac-tmpl/bootstrap/images/itemtypes/default.png" class="itemtype-icon"/>
            <xsl:value-of select="$itype"/>
        </xsl:otherwise>

    </xsl:choose>

</span>

<!-- ===== ITEM TYPE WITH ICON END ===== -->

🎨 Step 3: Add Styling

Go to:

Koha → Administration → System Preferences → OPACUserCSS

Add:

.itemtype-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.itemtype-icon {
    width: 18px;
    height: 18px;
}

🔄 Step 4: Restart Services

Run:

sudo systemctl restart koha-common
sudo systemctl restart apache2

Then refresh your browser (Ctrl + F5).


🎯 Final Result

Your OPAC search results will now display clean, visual item types like:

  • 📘 Book

  • 🎓 Thesis

  • 📰 Article

  • 📜 Manuscript

  • 📖 Periodical

Each with a matching icon and label.


⚠️ Troubleshooting

Icons not showing?

  • Check file path:

/opac-tmpl/bootstrap/images/itemtypes/book.png
  • Test in browser:

http://your-koha/opac-tmpl/bootstrap/images/itemtypes/book.png

Wrong item type showing?

  • Verify MARC field:

942$c
  • Ensure values match exactly:

Books, Thesis, Articles, Manuscript, Periodicals

💡 Pro Tips

  • Use SVG icons for better quality

  • Keep icon sizes consistent

  • Avoid hardcoding too many conditions — keep it maintainable


🎉 Conclusion

With just a small XSLT customization, you can significantly enhance the user experience of your Koha OPAC. Clear item type labels and icons make browsing faster, easier, and more visually appealing.


🚀 What’s Next?

You can further enhance your OPAC by:

  • Adding filters by item type

  • Grouping results (Books / Theses / Journals)

  • Customizing the detail page layout


If you need help with advanced customization, feel free to explore further or extend this implementation.

Happy customizing! 🎯

Saturday, March 28, 2026

Display in OPAC of Different datatypes

⚠️
Diagnosis: Your Koha is defaulting to "text" because the Item Type Codes in your MARC (952$y) do not match the codes in your Koha Administration.
Solution 1: Define Item Types in Koha Admin

Go to Koha Administration → Item types and create these entries exactly as they appear in your MARC data:

Code (Must match 952$y) Description Suggested Icon
BK Book bridge/book.gif
ARTICLE Journal Article bridge/periodical.gif
THESIS Research Thesis bridge/thesis.gif
BIBLIO Bibliographic Entry bridge/reference.gif
Solution 2: Adjust MARC Leader (LDR) for Theses

If an item is missing, Koha looks at Position 06 of the Leader. To differentiate theses from standard books:

  • Books/Articles: Set Position 06 to a (Language material).
  • Theses/Manuscripts: Change Position 06 to t (Manuscript language material).
MarcEdit Fix: Click the LDR field → Type of Record → Select "t-Manuscript language material".
Solution 3: Enable XSLT System Preferences

Ensure your system is configured to show icons in the OPAC:

  1. Search for DisplayOPACiconsXSLT → Set to Show.
  2. Search for OPACNoItemTypeImages → Set to Show (this enables images).
Solution 4: Collection Codes (CCODE)

To see "Sirah Hub" or "SNK Bibliography" clearly next to the item type, add Collection Codes:

  1. Go to Admin → Authorized values → CCODE.
  2. Add values: SIRAH (Sirah Research Hub) and SNK (Sher Nowrooz Khan).
  3. Add the tag to your MARC: =952 \\$8SNK

Standardizing these administrative settings ensures your scholarly Hub is visually organized and professional for researchers.

Marc Tags of Different Data Types

Koha 25.11 "Sirah Hub" Test Suite

MARC21 Record Samples for Multilingual & Scholarly Validation

1. Physical Book (Multi-Holding) Consolidation Test
=LDR 00000nam 2200000ia 4500 =001 hub-book-001 =020 \\$a9789694080123 =100 1\$aNomani, Shibli. =245 10$aSirat-un-Nabi /$cShibli Nomani. =260 \\$aLahore :$bReligious Publications,$c2010. =952 \\$aIRI$bIRI$pML100445-IRI$yBK$t1$o297.63 NOM =952 \\$aSSMK$bSSMK$p120684-SSMK$yBK$t1$o297.63 NOM
2. Journal Article (Analytical Entry) 773 Linking Test
=LDR 00000nab 2200000ia 4500 =001 hub-art-001 =100 1\$aAhmad, Zohaib. =245 10$aProphetic Diplomacy in the Medinan Period :$ba bibliometric review. =773 0\$tJournal of Islamic Thought and Civilization$gVol. 10, No. 2 (2025)$x2070-0326 =856 40$uhttps://define.pk/articles/prophetic-diplomacy.pdf$zFull Text PDF
3. Thesis/Dissertation 502 Academic Test
=LDR 00000nam 2200000ia 4500 =001 hub-thesis-001 =100 1\$aAhmed, Rauf. =245 10$aMapping Sirah Literature in Pakistan :$ba comparative study of digital repositories. =502 \\$bPh.D.$cInternational Islamic University, Islamabad$d2026.
4. Virtual Bibliographic Citation (SNK) 510 Citation Test
=LDR 00000nam 2200000ia 4500 =001 hub-snk-045 =100 1\$aHamidullah, Muhammad. =245 10$aThe Life and Work of the Prophet of Islam. =510 4\$aSher Nowrooz Khan, Bibliography of Sirah Literature$cEntry No. 45. =952 \\$aSNK_BIB$bSNK_BIB$pSNK-45$yBIBLIO$t1$oREF SNK-45

🔍 Validation Checklist

  • The "Split" Display: Does "Nomani" show both IRI and SSMK availability in the OPAC results?
  • Link Integrity: Is the "Full Text PDF" link in the Article record clickable?
  • Note Visibility: Does the 510 tag appear clearly in the "Description" or "Notes" tab of the Hamidullah record?
  • Virtual Branch: Verify that the SNK_BIB item is listed as "Not for Loan."

Cataloging Theses and Dissertations in Koha for Sirah Research

Cataloging Theses and Dissertations in Koha for Sirah Research

Integrating Theses & Dissertations into Your Sirah Database

Adding theses and dissertations to a specialized Sirah database provides researchers with access to deep, original scholarship that often precedes published books. In the MARC21 standard, theses are treated as a specific type of monograph but require one essential field to be functionally useful: the 502 field.

1. Essential MARC Tags for Theses

The primary tag that defines a record as a thesis is the 502 Dissertation Note. This field captures the academic context of the work.

MARC Tag Subfield Description Example
502 $b Degree Type Ph.D. or M.Phil.
502 $c Granting Institution University of the Punjab, Lahore
502 $d Year Granted 2023
500 $a General Note Supervisor: Dr. Mahmood Ahmad

Example MARC Construction:

100 1# $a Siddiqui, Ahmad Ali, $e author.
245 10 $a Evolution of Sirah Literature in the Subcontinent : $b a critical study.
502 ## $b Ph.D. $c International Islamic University, Islamabad $d 2022.
650 #0 $a Muhammad, $c Prophet, $d -632 $x Biography $x History and criticism.

2. Professional Management in Koha

To ensure these research papers are distinct from general library books, use these two administrative strategies:

A. Create a "Thesis" Item Type

Navigate to Koha Administration > Item Types and create a new code: THESIS. Assign it a specific icon, such as a graduation cap or a scroll. This visual cue helps users instantly identify the material in search results.

B. Dedicated "Sirah Thesis" Framework

Instead of the "Default" framework, build a custom one for theses. This allows you to make the 502 field mandatory and hide irrelevant fields like ISBN (020), which academic dissertations rarely possess. You can easily create this by using "Framework Export/Import" to clone your default settings and pruning the unnecessary tags.

Pro Tip: Linking Digital Versions
Many modern Sirah theses in Pakistan are available as PDFs. Use Tag 856 $u to store the URL and 856 $y for link text like "Read Full Thesis (PDF)". This turns your catalog into a direct portal for digital research.

3. Search & Discovery

Once populated, you can guide researchers to use the Advanced Search feature. By selecting the "Thesis" Item Type specifically, they can filter out general literature and focus purely on primary academic research.

Summary: The "One Point" Sirah Collection Plan

By following these guides, your digital library now supports a multi-dimensional research experience:

  • Books: Managed via standard MARC cataloging.
  • Articles: Connected via Analytical links (773 field).
  • Theses: Detailed via Dissertation notes (502 field).

Empowering Islamic scholarship through advanced library metadata standards.

Expanding Your Research Hub: How to Catalog Articles and Chapters in Koha

Building a Powerful Sirah Database: Cataloging Articles and Component Parts in Koha

From Books to Research Hub: Cataloging Articles & Analytics in Koha

Adding articles—such as journal papers, book chapters, or seminar presentations—alongside your monographs is a powerful way to enhance your Sirah Research Database. In library science, these are referred to as Analytics or Component Parts.

To integrate these into Koha, you must link the article to its "host" (the parent journal or book) using specific MARC tags and adjust your display settings to make them stand out in the OPAC.

1. The Core MARC Tags for Articles

When cataloging an article, the most significant changes occur in the Leader and the 773 field.

A. The Leader (Position 07)

This position identifies the bibliographic level of the record. Changing this tells Koha: "This is a part of a larger work, not a standalone book."

  • Leader/07: Change from m (monograph) to a (Monographic component part).

B. The 773 Field (Host Item Entry)

This field creates the bridge between your article and the host record.

  • 773 $t: Title of the host (e.g., Journal of Islamic Studies).
  • 773 $g: Relationship info (e.g., Vol. 5, No. 2 (2024), pp. 10-25).
  • 773 $w: The Biblio Number of the host record in your Koha system. This creates a functional, clickable link in the OPAC.

2. Differentiating Articles from Books in the OPAC

Researchers need to know at a glance if they are looking at a 500-page book or a 10-page article. Here are three ways to achieve that:

Method 1: Using Item Types (Recommended)

Create a specific Item Type for articles in Administration > Item Types. Assign it a "document" or "page" icon. When users see the icon next to the search result, they will immediately recognize the material type.

Method 2: Custom Visual "Badges" via CSS

You can add a visual highlight to article results using the OPACUserCSS system preference:

/* Highlight 'Article' results with a green border */
.results_summary.itemtype_ARTICLE {
    border-left: 5px solid #2ecc71;
    background-color: #f9fff9;
}
    

Method 3: XSLT Customization

For a professional finish, modify your OPACXSLTResultsDisplay. You can set a condition: If Leader/07 = 'a', display the Host information (773) prominently instead of the standard publisher info.

3. Comparison: Book vs. Article Cataloging

Feature Book (Monograph) Article (Component Part)
Leader/07 m a
Main Title (245) Title of the Book Title of the Article
Source Information 260/264 (Publisher) 773 (Host Journal/Book)
Identifier 020 (ISBN) 022 (ISSN of the Host)

4. Essential System Preferences

To ensure your "One Point" database functions smoothly, enable these settings:

  • ShowComponentRecords: Set to "Show". This adds a "Components" tab to the parent book record, listing all chapters inside.
  • EasyAnalyticalRecords: Set to "Display". This simplifies the process of linking articles to parents in the staff interface.

By following these steps, you provide your researchers with a deeper, more interconnected view of scholarly literature.

Claude

Claude for Academics — A Research Companion Research & Academia Claude as Your Research Companion A practical gui...