Appearance
Search engine optimization
A Box Page comes with many SEO features built in.
You can configure the meta title, description and robots tags, OpenGraph tags as well as a canonical URL in the Boxes Editor's -> Page -> SEO Tab.
Setup required!
In order for the SEO attributes to be rendered, you need to add a {% placeholder meta %} tag to the <head> section of your layout.
Customizing the meta tags
All SEO meta tags are generated in the boxesPage::seo.htm partial.
To customize the output, copy the file plugins/offline/boxes/components/boxesPage/seo.htm to themes/<your-theme>/partials/boxesPage/seo.htm and customize it.
OpenGraph images
The OpenGraph image for the page can be uploaded in the backend on the Boxes Editor's -> Page -> SEO Tab.
You can also override the OpenGraph image from any Partial's Twig content by calling the setOpenGraphImage method on the boxesPage variable.
twig
{% set image = someModel.some_images_relation.first() %}
{{ boxesPage.setOpenGraphImage(image) }}Alternatively, use the setBoxesPageOpenGraphImage method from any component that is rendered on a Boxes Partial.
php
<?php namespace YourVendor\YourPlugin\Components;
use Cms\Classes\ComponentBase;
class SomeComponent extends ComponentBase
{
public function onRun()
{
// Set the Boxes Page's OpenGraph image.
if ($this->methodExists('setBoxesPageOpenGraphImage')) {
/** @var \System\Models\File $image */
$image = SomeModel::first()->image;
$this->setBoxesPageOpenGraphImage($image);
}
}
}