3.5 Customizing on-page displays

On-page menu : how to define which items are displayed

Available items

Name

Content

"addMetadata"

"Add metadata" button

"importNotes"

"Import notes" button

"viewItemInfo"

"View item information" button

Opens the item in the library search panel.

"openZoteroLocal"

"Open in Zotero (local)" button

Link to the item in Zotero (standalone app).

"openZoteroWeb"

"Open in Zotero (web)" button

Link to the item in Zotero (web library).

"pdfLinks"

Links to each PDF attachment for the item

"sciteBadge"

Scite.ai badge of citations (mentioning, supporting, contrasting)

"connectedPapers"

Link to the item on ConnectedPapers

"semanticScholar"

Link to the item on Semantic Scholar

"googleScholar"

Link to the item on Google Scholar

"citingPapers"

List of items which cite the current item, in Zotero library + elsewhere.

In the code

// Add a 'pageMenu' setting, with its 'defaults' property as an Array of options

zoteroRoam_settings = {
    // dataRequests: [...],
    pageMenu: {
        defaults: ["addMetadata", "importNotes", "viewItemInfo", "pdfLinks"]
    }
}

Display triggers

You can choose which pages should display the on-page menu/contextual buttons, by defining a trigger function. The function should take as its only argument the title of the page, and return a Boolean (true | false).

// By default, the on-page displays will only be shown if the page title
// is more than 3 characters in length, to avoid wasteful lookups

zoteroRoam_settings = {
    // dataRequests: [...],
    pageMenu: {
        trigger: (title) => {
            return title.length > 3 ? true : false;            
        }
    }
}

The title will be the full title of the Roam page - if the page is in citekey format (@citekey), that will include the @. The trigger function can be as simple or as complex as needed : different rules could be written for DNPs vs. regular pages, for example, or the Roam Alpha API could be used to check the page's contents, run queries on the graph...

Last updated