Meta og:image property in site header for link sharing icons

I would like to add a link in my root site’s header – not for different Omeka S sites but the base URL of Omeka S – mainly so I can have WhatsApp and other apps render the site’s icon automatically when I share links via mobile.

In Omeka Classic I would do this inside my theme’s header.php by adding this line and a link to my image file:

<meta property="og:image" content="/pathtomyimage.png">

As Omeka S themes and sites work differently than in Classic, so the site header meta properties are not editable in the theme’s directory, and are part of the core Omeka S views. I would rather not mess around with these (though I do so for styling my base URL landing page in /application/view/omeka .

While there are other ways to create a site favicon independently of the Omeka installation for display in browser tabs, desktop and mobile page icons, etc. *by creating a PNG favicon in my site’s public html directory), the only way I know to render a preview sharing icon in WhatsApp is via the above OpenGraph protocol method.

Ideally this meta property (og:image) should be configurable in the global administrator settings, where I could add an image from my assets as one would within a site’s theme settings.

Hello

Messing with core views is not that harmful, but you’ll have to find a way to not overwrite your changes when installing future updates.

Alternatively, this can be achieved by writing a very simple module that attaches to the view.layout event to add the required head meta tags.
https://omeka.org/s/docs/developer/events/server_event_reference/
The module could also add admin side configuration fields.

Have a nice day

Thanks, I’m not a dev so couldn’t write the module myself and as you advised would rather not poke around too much in the core views. Any other solution to add meta properties to the overall site header?

One cannot configure other meta properties except locale and site title and description in the Admin Settings. This and editing the main landing page with site selector requires manual editing of the core views.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.