Tutorial: Custom Meta Tags

From Lorekeeper Wiki
Jump to navigation Jump to search

This is a brief tutorial regarding meta tags as they exist in Lorekeeper, as well as how to define section- or page-specific info within them.

Meta Tags, Lorekeeper, & You

Meta tags, broadly speaking, provide for the link previews displayed on social media, within Discord, etc. In Lorekeeper, they are pre-set with certain information.

These information a meta tag displays is as follows:

  • Title
    • In Lorekeeper, this is set by default to the title of the linked page.
  • Description
    • This is set to a default message configurable within config/lorekeeper/settings, under site_desc.
    • Note that this will be truncated past a certain length.
  • Image
    • This is set by default to the Lorekeeper "inventory" image. A new image may be uploaded for this within the Site Images admin panel.

Of course, if the linked page requires being logged in to access, it will display only the preview for the login page.

Adding Custom Info to Meta Tags

Custom information within meta tags is defined within Lorekeeper via "sections".

The sections called for by meta tags are as follows:

  • title
  • meta-desc
    • May not contain quotes
  • meta-img
    • Must be an image URL

However, the title section is already defined in sections' layout blade and/or for individual pages within them, and is already set per page/does not need to be modified.

So, in order to add a custom value to the meta tag for a specific blade, you would add the relevant section to it and, contained within that section, the relevant information.

For instance, the section present within each of the character-relevant blade files-- which substitutes the character's thumbnail image in instead of the site's default meta tag image-- is as follows:

@section('meta-img') {{ $character->image->thumbnailUrl }} @endsection

For characters, this is defined on each character-relevant blade-- character, bank, character logs, etc.

Another example occurs in Extensions:Item Entry Expansion. Here, a custom meta tag description is defined in the added blade for an individual item, alongside other values defined as part of that extension.


@if(isset($item->category) && $item->category) <p><strong>Category:</strong> {{ $item->category->name }}</p> @endif

@if(isset($item->rarity) && $item->rarity) :: <p><strong>Rarity:</strong> {{ $item->rarity }}: {{ $item->rarityName }}</p> @endif

 :: {!! $item->description !!}

@if(isset($item->uses) && $item->uses)  :: <p><strong>Uses:</strong> {!! $item->uses !!}</p> @endif