Meta

Meta blomstra/meta

Adds document meta: open graph, twitter, schema.org & other seo information

Downloads
0
Subscribers
0

This Flarum extension superpowers your Flarum forum with meta tags for:

  • Twitter
  • Open Graph
  • Schema.org

The metadata for this extension is generated not on request of the page, but whenever content changes. The processing is pushed to the queue and simply loaded from one database table for performance and scalability reasons.

Requirements

  • PHP 8.0+.
  • Chrome (headless) browser:
    • Ubuntu, CentOS: https://geekflare.com/install-chromium-ubuntu-centos/
  • A queue, like the database queue, horizon or redis queue.

Premium

This extension requires an active subscription from extiverse. Once your subscription is active you can follow the instructions on the Extiverse subscriptions page to configure composer. Once completed you can run the following command for installation:

composer require blomstra/meta:"*"

For updates:

composer require blomstra/meta:"*"
php flarum migrate
php flarum cache:clear

Managed Flarum communities that we host on our hosting platform (Blomstra) have access to all premium extensions by Blomstra without additional cost.

Enable the extension inside the admin area.

First-time rebuild

To generate meta information and images you can use the following command:

php flarum blomstra:meta:rebuild

This process can take quite a while, especially on larger communities.

Extend

Meta types

You can add new types of meta objects into the extension. For instance for your own extension.

return [
    (new \Blomstra\Meta\Extend\Meta)
        ->addType(YourTypeClass::class),
];

Image generation

You can override the Theme and Template for the images generated for open graph.

  • A Theme defines image size, colors and other variables that, by default, rely on the theme of your forum.
  • The Template defines where what is placed. It defines the layout of the generated image.

You can add your own by using the Extender:

return [
    (new \Blomstra\Meta\Extend\Meta)
        ->addTheme(YourThemeClass::class)
        ->addTemplate(YourTemplateClass::class),
];

You can provide an optional second argument to conditionally load the theme or template:

return [
    (new \Blomstra\Meta\Extend\Meta)
        ->addTheme(YourThemeClass::class, function (\Blomstra\Meta\Types\Type $type, \Flarum\Database\AbstractModel $model) {
            return $type instanceof \Blomstra\Meta\Types\Discussion 
                && \Illuminate\Support\Str::endsWith($model->user->email, '@blomstra.net');
        }),
];

All premium extensions by Blomstra are also available for free with any of our managed Flarum communities.


FAQ

Where can I get this thing of beauty? Head over to extiverse.com/extension/blomstra/meta, create an account, verify your mail address and choose a plan.

How is the image generated? This extension uses Chrome/Chromium behind the scenes to create an image from html generated through Flarum.

Why is Chrome required? Different implementations have been considered and tested to keep this extension simple, but also flexible. The ability to generate images from templates is something we absolutely wanted to implement. Wkhtmltoimage, puppeteer and other were looked at but either were too consistent in their results across different platforms or required a dependency (eg node) we considered too demanding for smaller hosting environments.

Stylesheets aren't loading? In case you run your image generation/jobs inside a docker environment and your stylesheet isn't available, you can override the application URL for the generator using an extender:

return [
    // ..
    (new \Blomstra\Meta\Extend\Chrome)->setUrl('http://localhost:8080'),
]

The extension can't find Chrome? In case your Chrome is installed in a location the extension cannot automatically find, you can force its path:

return [
    // ..
    (new \Blomstra\Meta\Extend\Chrome)->setPath('/home/ckent/chrome/chrome'),
]

Where are the images stored? The og images are stores in the Flarum public assets directory.

I have another question. Reach out to us via https://helpdesk.blomstra.net. We will get back to you as soon as we can. If you have a running subscription please mention when you started your plan and/or which plan you are on. Always add sufficient information when reporting errors. We prefer errors being reported here, but understand that sometimes you can't.


  • Blomstra provides managed Flarum hosting.
  • https://blomstra.net

Attribution Icon made by Smashicons from Flaticon.

Versions

  • Version 0.1.0-beta.2.

    Likely works with Flarum v1.8.5.

  • 1 additional versions.
  • Extension created.