1.3 Subthemes

This section shows you how to use subthemes in the Goobi viewer.

Goobi workflow

A new metadata ViewerSubTheme must be added to the ruleset. This is then also added to DocStructs that have the CatalogIDDigital metadata configured as a mandatory metadata.

The relevant parts from the ruleset are:

<MetadataType>
    <Name>ViewerSubTheme</Name>
    <language name="de">Alternative Darstellung</language>
    <language name="en">Alternative view</language>
</MetadataType>

<!-- [...] -->

<metadata num="1o" DefaultDisplay="true">ViewerSubTheme</metadata>

<!-- [...] -->

<NamespaceDefinition>
    <URI>https://intranda.com/MODS/</URI>
    <prefix>intranda</prefix>
</NamespaceDefinition>

<!-- [...] -->

<Metadata>
    <InternalName>ViewerSubTheme</InternalName>
    <WriteXPath>./mods:mods/mods:extension/#intranda:viewersubtheme</WriteXPath>
</Metadata>

In the configuration file goobi_metadataDisplayRules.xml a drop-down menu with the desired subtheme names is assigned:

<context projectName="*">
    <select1 ref="ViewerSubTheme">
        <item selected="true">
            <label>Keine</label>
            <value />
        </item>
        <item selected="false">
            <label>Mein Subtheme</label>
            <value>my-subtheme</value>
        </item>
    </select1>
</context>

Goobi viewer Indexer

The metadata viewerSubTheme is written to a separate field within the Solr Index. The following field definition must be added to the configuration file:

<init>
    <namespaces>
        <list>
            <intranda>https://intranda.com/MODS/</intranda>
        </list>
    </namespaces>
<init>

<!-- [...] -->

<MD2_VIEWERSUBTHEME>
    <list>
        <item>
            <xpath>mets:xmlData/mods:mods/mods:extension/intranda:viewersubtheme</xpath>
            <addToDefault>false</addToDefault>
            <addUntokenizedVersion>false</addUntokenizedVersion>
        </item>
    </list>
</MD2_VIEWERSUBTHEME>

Goobi viewer Core

The following adjustment must be made in the Goobi viewer Core to ensure correct evaluation:

<viewer>
    <theme mainTheme="reference" 
           discriminatorField="MD2_VIEWERSUBTHEME" />
</viewer>

Template

In the file template.html the following block is added after the custom.css:

<!-- SUBTHEME CSS -->
<h:panelGroup rendered="#{navigationHelper.subThemeDiscriminatorValue != null and navigationHelper.subThemeDiscriminatorValue != '-'}">
    <link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/themes/#{navigationHelper.theme}/css/dist/#{navigationHelper.subThemeDiscriminatorValue}.min.css" />
</h:panelGroup>

Each sub-theme has its own CSS file that contains its own CSS definitions for that sub-theme. The order in which they are included in the template.html file can be used to overwrite any value of the global viewer.css file or the theme specific custom.min.css file with subtheme-specific values in this subtheme-specific file.

Last updated