Download the PHP package fabianmichael/kirby-meta without Composer

On this page you can find all versions of the php package fabianmichael/kirby-meta. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kirby-meta

Kirby Meta

⚠️ Warning: This plugin is in beta state. Documentation and implementation are still incomplete.

This piece of code handles the generation of meta tags for search engines, social networks, browsers and beyond.

Screenshot 2022-01-14 at 09-57-24 Mirin Avo’s Kitchen

Key features:

Future plans:

This plugin is completely free and published under the MIT license. However, if you are using it in a commercial project and want to help me keep up with maintenance, please consider to ❤️ sponsor me for securing the continued development of the plugin.

Requirements

How it works

The plugin looks for metadata from a page's content file (e.g. article.txt) by the corresponding key. If the page does not contain the specific field, it looks for a metadata method on the current page model, which can return an array of metadata for the current page. If that also fails, it will fall back to default metadata, as stored in the site.txt file at the top-level of the content directory.

That way, every page will always be able to serve default values, even if the specific page or its model does not contain information like e.g. a thumbnail or a dedicated description.

Installation & Setup

Install using composer (recommended):

Alternative download methods:

You can also download this repository as ZIP or add the whole repo as a submodule. To run from source, you need to install the dependencies : composer install.

Available configuration options

The options below have to be set in your config.php. Please note that every option has to be prefixed with the plugin namespace, e.g. sitemap => fabianmichael.meta.sitemap.

Key Type Default Description
sitemap bool true When true, will generate an XML sitemap for search engines. The sitemap includes all listed pages by default. ⚠️ If you disable the robots setting, no robots.txt will be served to tell search engines where your sitemap is located.
sitemap.detailSettings bool false When true, the <changefreq> and <priority> tags are included in the sitemap and their corresponding fields are displayed in the panel.
sitemap.pages.exclude array [] An array of page IDs to exlude from the sitemap. Values are treated as regular expressions, so they can include wildcards like e.g. about/.*. The error page is always excluded.
sitemap.pages.includeUnlisted array [] An array of page IDs to include in the sitemap, even if their status is unlisted. Values are treated as regular expressions, so they can include wildcards like e.g. about/.*.
sitemap.templates.exclude array [] An array of template names to exlude from the sitemap. Values are treated as regular expressions, so they can include wildcards like e.g. article-(internal|secret)
sitemap.templates.includeUnlisted array [] An array of templates to include in the sitemap, even if their status is unlisted. Values are treated as regular expressions.
schema bool true Generates Schema.org markup as JSON-LD.
social bool true Generates OpenGraph markup.
twitter bool true Generates Twitter Cards markup. Only has an effect, if social is also enabled. Since 0.2.0-beta (⚠️ deprecated).
robots bool true Generates the robots metatag and serve robots.txt at http(s)://yourdomain.com/robots.txt.
robots.canonical bool true Generates canonical url meta tag. Requires robots option to be true.
robots.index bool true Allows crawlers to index pages. Can be overriden in global or page-specific settings from the panel. Requires robots option to be true for having an effect. If a page is excluded from the sitemap or unlisted, the robots meta tag will always contain noindex.
robots.follow bool true Allows crawlers to follow links on pages. Can be overriden in global or page-specific settings from the panel. Requires robots option to be true for having an effect.
robots.archive bool true Allows crawlers to serve a cached version of pages. Can be overriden in global or page-specific settings from the panel. Requires robots option to be true for having an effect.
robots.imageindex bool true Allows crawlers to include images to appear in search results. Can be overriden in global or page-specific settings from the panel. Requires robots option to be true for having an effect.
robots.snippet bool true Allows crawlers to generate snippets from page content. Can be overriden in global or page-specific settings from the panel. Requires robots option to be true for having an effect.
robots.translate bool true Allows crawlers offer automated translation of your content. Can be overriden in global or page-specific settings from the panel. Requires robots option to be true for having an effect.
title.separators array ["~" , "-" , "–" , "—" , ":" , "/", …] List of available separator options for the <title> tag. The separator can be selected in the panel and is placed between page title and site title. 
theme.color string\|null null If not empty, will generate a corresponding meta tag used by some browsers for coloring the UI.
panel.view.filter Provides a filter function for hiding certain pages from the metadata debug view in the panel. See the Kirby docs on $pages->filter() for details.

Blueprint setup

Your site and page blueprints need to use tabs, as the plugin's input fields all come in a tab. Meta comes with tab blueprints that need to be added to your site and page blueprints accordingly:

Template setup

Include the meta snippet within your <head> element, preferably before loading any scripts or stylesheets:

Now you are ready to add/edit metadata from the panel.

Advanced usage

Providing metadata from page models

Sometimes, you want special behavior for certain templates. The easiest way to achieve this is by creating a page model and implementing a $page->metadata() method, that returns an array some or even all of the following keys:

Key Type Description
meta_description string Provide a default description that is used, when the user had not entered a dedicated description for this page. This could e.g. be a truncated version of the page's text content.
og_title_prefix string Will be put in front of the page's OpenGraph title, e.g. 'ℹ️ ' or '[Recipe ]
og_image File Kirby\Cms\File A File object, that sets the default OpenGraph image for this page. You can even generate custom images programatically and Wrap them in a File object, e.g. for the docs of your product (getkirby.com does this for the reference pages).
@graph array Things to add to the JSON-LD metadata in the page's head. If you need to reference the organization or person behind the website, use url('/#owner'). If you need to reference the website itself, use url('/#website').
@social array Extend the social meta tags generated by the plugin.

Using hooks

the meta plugin provides a set of handy hooks, allowing you to further add/remove/modify metadata without overriding the built-in snippets or having to set up a page model for every template.

⚠️ Hooks are a powerful tool that can break the plugin's expected behavior for editors working on the panel. Use with care!

meta.load:after

After metadata has been loaded by calling the $page->metadata() method on a model. This allows you to inject additional data.

meta.jsonld:after hook

After the Schema.org graph has been generated. This allows you to pass additional data to the array.

meta.social:after

Allows you to alter the OpenGraph/Twitter card data.

'meta.sitemap… hooks

These hooks allow you to completely alter the way how the sitemap is being generated. These functions are meant to manipulate the provided DOM document and elements directly and should not return anything.

Manipulating indexed pages

A few helpers are available for manipulating pages:

Page Method

If you'd like to know if a page is indexed in the sitemap, you can use $page->isIndexible() (returns a bool).

Site Method

To get all indexed pages according to your settings, you can use : $site->indexedPages() (returns a Kirby\Cms\Collection of pages).

Credits

This is partly based on an older version of the meta plugin, that I had initially developed for getkirby.com. I liked the idea so much, that I wanted to adapt it for general use on other websites.

It took a lot of inspiration (and some code) from other existing Kirby plugins, like MetaKnight by diesdas ⚡️ digital and Meta Tags by Pedro Borges.


All versions of kirby-meta with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
getkirby/composer-installer Version ^1.2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fabianmichael/kirby-meta contains the following files

Loading the files please wait ....