Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This section defines all metatags which are used to have defined in a website. It also contains the most relevant OG-Tags for facebook. It can also be used as an example how to read FAL images related to a page record. Here it is used as og:image
<div xmlns:v=""
<f:section name="MetaTags">
{v:resource.record.fal(record: page, field: 'media', table: 'pages') -> v:iterator.extract(key: 'uid') -> v:iterator.first() -> v:var.set(name: 'pageMedia')}
<v:page.header.meta name="keywords" content="{page.keywords}" />
<v:page.header.meta name="description" content="{page.description}" />
<v:page.header.meta name="og:title" content="{page.title}" />
<v:page.header.meta name="og:type" content="article" />
<v:page.header.meta name="og:url" content="{v:page.absoluteUrl()}" />
<v:page.header.meta name="og:description" content="{page.description}" />
<f:if condition="{pageMedia}">
<v:page.header.meta name="og:image" content="{f:uri.image(src: pageMedia, treatIdAsReference: 1, maxHeight: 1024, maxWidth: 1024) -> v:format.prepend(add: '{v:page.siteUrl() -> v:format.substring(length: \'-1\')}')}" />
<v:page.header.meta name="apple-mobile-web-app-capable" content="yes" />

This comment has been minimized.

Copy link

lucasinteractive commented Jan 22, 2015

The helper var.set and are deprecated right now. To make the script working with the current version of vhs (2.1.x) change

v:var.set(name: 'pageMedia')
v:variable.set(name: 'pageMedia')


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.