Basic Customization Tutorial ​
This tutorial shows how to customize a corpus in the BlackLab Frontend by adding a custom JavaScript file and changing the displayed title of your documents.
Steps ​
Create the config directory for your corpus.
By default, this is/etc/projectconfigs/
. If your corpus is calledexample
, your config directory will be/etc/projectconfigs/example/
. Use your custom paths if necessary.Copy the default
search.xml
into your corpus directory.
You can find the default atsrc/main/resources/interface-default/search.xml
.
Copy it to:/etc/projectconfigs/example/search.xml
Add a config option to include a custom script on the
search
page.
Edit yoursearch.xml
and add:xml<CustomJs page="search">${request:corpusPath}/static/js/custom.search.js</CustomJs>
Create a matching JavaScript file.
Create the file:/etc/projectconfigs/example/static/js/custom.search.js
Add the following snippet to your
custom.search.js
:jsvuexModules.ui.getState().results.shared.getDocumentSummary = function(metadata, specialFields) { return 'This is everything we know about the document: ' + JSON.stringify(metadata); }
Restart your server and perform a search in your corpus to see the changes.
For example: http://localhost:8080/blacklab-frontend/example/search/docs?patt=""NOTE: You don't need to restart the application constantly. Simply set
cache=false
in the mainblacklab-frontend.properties
config file to disable caching of files by the server.