Modifying the Preview Metadata
In this chapter, you will explore how to modify the metadata that appears at the top of the document preview panel.
The out-of-the-box metadata that displays at the top of the preview panel in Mint includes the location (of the document), authors, modified, and docformat.
The authors and modified metadata only display if they are present in the record.
In this tutorial, you will add two additional pieces of metadata:
- Executive Titles (stored in entity13) using the exectitle column alias.
- Financial Terms (stored in entityt14) using the finance column alias.
These metadata will only display if they are present in the selected record.
If you are using your own Sinequa instance, you should modify these values for your own selected metadata.
Modifying the preview-default.component.html File
-
Go to src > components > preview > preview-header, and open the preview-header.html file.
-
Locate the following:
<div [class]="cn('w-full', headerCollapsed() && 'hidden')">
-
Within this div, locate the following code blocks:
@if ((article().authors || []).length > 0)
@if (article().modified)
These blocks display the authors and modified metadata if it is present in the selected record.
In this case, article is a property of the PreviewHeaderComponent, computed from the record as declared in the preview-header.ts file.
-
After the
@if (article().modified)
block, add the following:@if ((article()['exectitle'] || []).length > 0) {
<tr>
<th>{{ 'jobTitle' | transloco }}</th>
<td class="flex flex-wrap gap-2">
<Metadata class="badge badge-sm empty:hidden" [article]="article()!" metadata="exectitle" />
</td>
</tr>
}
@if ((article()['finance'] || []).length > 0) {
<tr>
<th>{{ 'financialTerm' | transloco }}</th>
<td class="flex flex-wrap gap-2">
<Metadata class="badge badge-sm empty:hidden" [article]="article()!" metadata="finance" />
</td>
</tr>
}
The exectitle property comes from an index signature, so it must be accessed using ['exectitle']
.
- Save your changes.
If you followed the Connecting to Sinequa tutorial, Mint should recompile automatically. If not, run the npm run start
command in the terminal.
-
Go to your Mint application and execute a search for finance.
-
Click on the first result, which should be Outline of finance, to display the HTML document preview.
You should see the Job Title (exectitle) and Financial Terms (finance) metadata displayed at the top of the preview panel.
Notice that the labels for the metadata look somewhat odd. Currently, they use the references found in
<th>{{ 'jobTitle' | transloco }}</th>
This approach allows you to internationalize the labels in Mint.
For a detailed explanation, see the Tabs and Internationalization tutorial.
-
Go to src > assets > i18n, and open the en.json file.
-
Add the following inside the root object:
"jobTitle": "Job Titles",
"financialTerm": "Financial Terms",
-
Save your changes.
-
Go back to Mint and refresh.
You should see the Job Title and Financial Terms with the correct labels.