Multisite meta keywords and descriptions

Hello

For my current project, I am using Multisite for a bilingual website. For SEO purposes, the meta keywords and descriptions also need to be bilingual.

How do you handle this? My idea would be to add a specific field for each in the blueprint for the navigation element.

Btw, the “Meta Title” and “Meta Description” in the settings of page are not usable for this.

Thanks!
Cheers

We have one mixin for this purpose like this:

uuid: aabb-seo-fields
handle: Aabb\SeoPage
type: mixin
name: SEO

fields:

    seo_title:
        label: SEO Meta title
        cssClass: char-counter
        span: left
        tab: SEO Primary
        trans: true

    seo_description:
        label: SEO Meta description
        size: tiny
        type: textarea
        cssClass: char-counter
        span: left
        tab: SEO Primary
        trans: true

    seo_keywords:
        label: SEO Meta keywords
        size: tiny
        type: textarea
        # cssClass: countable
        span: right
        tab: SEO Primary
        trans: true

    seo_og_image:
        tab: SEO OG
        label: OG_Image 
        type: fileupload
        mode: image
        span: left
        maxFiles: 1

    seo_og_image_media:
        label: OG_Image (Media)
        type: mediafinder
        mode: image
        span: right
        tab: SEO OG


    seo_og_title:
        label: OG title
        cssClass: char-counter
        span: left
        tab: SEO OG
        trans: true


    seo_og_description:
        label: OG description
        size: tiny
        type: textarea
        cssClass: char-counter
        span: left
        tab: SEO OG
        trans: true

    seo_og_type:
        label: OG Type
        tab: SEO OG
        default: website
        span: auto

We are adding this mixin to any blueprint type: structure, single, stream etc. MultiSite and language depends on the setup of the blueprint. This seo.yaml mixin takes it from there:

uuid: xxxxx-pages
handle: XXX\PageBuilder
type: structure
name: Pages
multisite: locale
drafts: true
softDeletes: true
.....

multisite: locale - makes the MultiSite magic. And trans: true for the fields forces translates.

PAGE(S)

We have /pages/any-page.htm and inside the page we can do:

[section pagedata]
handle = "XXX\PageBuilder"
identifier = "fullslug"
value = "{{ :fullslug }}"
isDefault = true
==
{% put custom_seo_title = pagedata.seo_title %}
{% put custom_seo_description = pagedata.seo_description %}

Output could be something like, lets say this sits in /themes/demo/site/meta.htm:

<title>{{ placeholder('custom_seo_title') ?: this.page.meta_title }}</title>
<meta name="description" content="{{ placeholder('custom_seo_description') ?: this.page.meta_description }}">

{% if placeholder('custom_seo_image') %}
<meta property="og:image" content="{{ placeholder('custom_seo_image') }}">
{% else %}
	{% if placeholder('custom_seo_media_image') %}
		<meta property="og:image" content="{{ baseUrl ~ placeholder('custom_seo_media_image') }}">
	{% else %}
		<meta property="og:image" content="{{ baseUrl }}/themes/aabb/assets/images/og.jpg">
	{% endif %}
{% endif %}

{% if placeholder('custom_og_type') %}
<meta property="og:type" content="{{ placeholder('custom_og_type') }}">
{% else %}
<meta property="og:type" content="article">
{% endif %}
1 Like

Hi @mrmax

That sounds very interesting. There are a few things I’m not familiar with yet, but I’ll figure them out.

Many thanks.

Cheers

2 Likes

The Translatable component has this feature too.