Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Commit

Permalink
v2-beta: fixes, new features, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobimori committed Feb 16, 2022
1 parent 9c3da53 commit 4b3fff3
Show file tree
Hide file tree
Showing 42 changed files with 4,327 additions and 6,615 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[*.{css,scss,less,js,json,ts,sass,html,hbs,mustache,phtml,html.twig,md,yml}]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
indent_size = 4
trim_trailing_whitespace = false

[site/templates/**.php]
indent_size = 2

[site/snippets/**.php]
indent_size = 2

[package.json,.{babelrc,editorconfig,eslintrc,lintstagedrc,stylelintrc}]
indent_style = space
indent_size = 2
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules
/.cache
/.cache
/vendor
20 changes: 20 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": true,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
1 change: 1 addition & 0 deletions LICENSE.md → LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
MIT License

Copyright (c) 2022, Tobias Möritz
Copyright (c) 2020, diesdas.digital GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
192 changes: 20 additions & 172 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,188 +1,36 @@
# Meta Knight – SEO for Kirby
# coralic Meta Knight – SEO for Kirby

Meta Knight is a SEO and Social Media Sharing Plugin for [Kirby](https://getkirby.com). Meta Knight makes it easier to work with meta information in Kirby's panel.
Our opinionated fork of diesdas.digital's Meta Knight—a SEO and Social Media Sharing Plugin for [Kirby](https://getkirby.com). Meta Knight makes it easier to work with meta information in Kirby's panel.

Meta Knight provides blueprints, snippets and custom preview sections. At the moment the plugin covers:
This fork includes several improvements as well as some customizations to meet our clients' needs, such as:

- Basic Meta Information (Title, Description, Keywords, Canonical URL, etc.) + Google Search Preview
- Open Graph + Facebook Sharing Preview
- Twitter Cards + Twitter Cards Preview
- Robots Settings

All of the above is neatly organized in a pre-composed SEO tab that can easily be added to any blueprint.

![Screenshot](screenshot.gif)

This plugin was originally developed at [diesdas.digital](https://www.diesdas.digital) by Jonathan Muth, Lorenz Seeger and Leslie Büttel. Meta Knight exists because we wanted to standardize the way we handle meta information across all our projects.

We'd also like to thank @distantnative for his help along the way! Without him this plugin wouldn't be what it is today.

## Config options

### Site title

#### Order

By default the _Page Title_ will be rendered before the _Site Title_. Resulting in a title tag that looks like this: `<title>Page Title – Site Title</title>`. If you want the _Site Title_ to come first, simply add the following lines to your Kirby `config.php` file:

```
'diesdasdigital.meta-knight' => [
'siteTitleAfterPageTitle' => false,
],
```

You'll then get a title tag that looks like this: `<title>Site Title – Page Title</title>`.

#### Customize home page title

By default the title tag of the home page will include both the _page title_ and the _site title_ and look like this: `<title>Page Title – Site Title</title>`. If you want to only display the site title on the homepage, simply add the following lines to your Kirby `config.php` file:

```
'diesdasdigital.meta-knight' => [
'siteTitleAsHomePageTitle' => true,
],
```

The title tage of your home page will then look like this: `<title>Site Title</title>`

The same can be done with the page title on the homepage

```
'diesdasdigital.meta-knight' => [
'pageTitleAsHomePageTitle' => true,
],
```

will result in `<title>Page Title</title>`

Keep in mind: Both options cannot be enabled at the same time.

### Customizeable `page title | site title` separator

The separator between page title and site title can be customized like this:

```
'diesdasdigital.meta-knight' => [
'separator' => ' \o/ ',
],
```

The default value is ` | `.

### Canonical URLs

Meta Knight gives you control over how the auto-generated canonical URLs for your pages are rendered. By default canonical URLs do not include the `www.` subdomain. If you wish the canonical URLs to include `www.` please set the following option in config.php:

```
'diesdasdigital.meta-knight' => [
'canonicalURLIncludesWWW' => true,
],
```
- Simplified options (via `metaknight-simple` tab blueprint)
- Specialized site-wide options
- Template support via [Kirby's Query language](https://getkirby.com/docs/guide/blueprints/query-language)
- Translation support (currently English + German)
- Default Twitter/OG image preview

Please note:
As well as some internal changes:

- Auto-generated canonical URLs will always be the `https://` version of any given page.
- Do not enable `canonicalURLIncludesWWW` if your Kirby site is running on another subdomain.
- A canonical URL that was manually entered in the SEO Tab will always override the auto-generated canonical URL of any given page.
- Preview generation on the backend for QL support
- KirbyUp as bundler instead of Parcel

In addition to the original plugin features:

- Basic Meta Information (Title, Description, Keywords, Canonical URL, etc.) + Google Search Preview
- Open Graph + Facebook Sharing Preview
- Twitter Cards + Twitter Cards Preview
- Robots Settings

---

## Installation

### Download

Download and copy this repository to `/site/plugins/kirby-meta-knight`.

### Git submodule

```bash
git submodule add https://github.com/diesdasdigital/kirby-meta-knight.git site/plugins/kirby-meta-knight
```

### Composer

```bash
composer require diesdasdigital/kirby-meta-knight
```

## Setup

How to add Meta Knight to Kirby:

1. Add this tab to your site's blueprint (site.yml): `seotab: seo` (Meta Knight uses the site's meta information as a fall back when no meta information is provided for a page)

2. Add this tab to all your page blueprints: `seotab: seo`

3. Add these two snippets to your head: `<?php snippet('meta_information'); ?>` + `<?php snippet('robots'); ?>`

Example:

```yaml
title: Site

tabs:
content:
icon: text
label: Content
sections:
drafts:
headline: Drafts
type: pages
status: draft
templates:
- default
- masthead
image:
query: false
unlisted:
headline: Unlisted
type: pages
status: unlisted
image:
query: false
listed:
headline: Listed
type: pages
status: listed
image:
query: false

seotab: seo
```
## Options
Currently the plugin isn't configurable via the `config.php` file. This is something we are thinking about adding in a future release.

## Development

### Development

You can start the dev process with …

```bash
yarn dev
```

This will automatically update the `index.js` and `index.css` of Meta Knight as soon as you make changes.
It will also enable hot module reloading in the panel. Reload the panel once and afterwards you should
see changes immediately without further reloading.

### Production

As soon as you are happy with the changed you've made to Meta Knight, you should build the final version with
We'd like to thank Jonathan Muth, Lorenz Seeger and Leslie Büttel at [diesdas.digital](https://www.diesdas.digital) for their lovely plugin. We love it and use it on almost all projects since <3

```bash
yarn build
```
## Usage

This will automatically create a minified and optimized version of your `index.js` and `index.css` that will improve load time in production environments.
`TODO` - sorry!

## License

MIT – See LICENSE.md for more info.
MIT – See [LICENSE](./LICENSE) for more info.

## Credits

Expand Down
85 changes: 85 additions & 0 deletions blueprints/fields/basic-meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
type: group
fields:
metaHeadline:
label:
de: Grundlegende Metadaten
en: Basic Meta Information
type: headline
numbered: false
metaTitle:
label:
en: Title (Override)
de: Titel (Überschreiben)
type: text
placeholder: '{{ page.title }}'
help:
de: Ein benutzerdefinierter Titel, welcher in der Vorlage verwendet werden kann. Überschreibt den normalen Seitentitel.
en: A user defined title that can be used in the template. Overrides the normal page title.
metaTemplate:
label:
en: Title Template (Override)
de: Benutzerdefinierte Titel-Vorlage
type: text
width: 1/2
placeholder: '{{ site.metaTemplate }}'
help:
de: Eine Vorlage, die für alle Seitentitel verwendet werden soll. "\{\{ title }}" wird durch den Unterseitentitel oder den benutzerdefinierten Titel ersetzt.
en: A template that is used for all page titles as it should be displayed on search engines. "\{\{ title }}" will be replaced by the page title or the user defined title.
inheritMetaTemplate:
label:
en: Inherit title template for child pages?
de: Sollen Unterseiten die Titel-Vorlage erben?
type: toggle
width: 1/2
help:
de: Wenn aktiviert, wird die Titel-Vorlage von Unterseiten übernommen.
en: If enabled, the title template will be inherited by child pages.
text:
- de: Nicht vererben, globale Titelvorlage verwenden
en: Don't inherit, use global title template
- de: Vorlage vererben, Unterseiten benutzen
en: Inherit, use parents' page title template
metaDescription:
label:
de: Beschreibung
en: Description
type: text
placeholder: '{{ site.metaDescription }}'
help:
de: Eine kurze Beschreibung des Inhalts der Seite, welche von Suchmaschinen angezeigt werden soll.
en: A short description of the site/page that will be displayed underneath the page title by search engines.
metaCanonicalUrl:
label:
de: Kanonische URL
en: Canonical URL
type: url
width: 1/2
placeholder: '{{ page.canonicalUrl }}'
help:
en: The canonical URL of the page. Will default to page URL when this field is empty.
de: Die kanonische URL der Seite. Damit kann bei mehrfach verwendetem Inhalt die Originalressource ausgewiesen werden. Wenn dieses Feld leer ist, wird standardmäßig die URL der Seite verwendet.
metaAuthor:
label:
de: 'Autor*innen'
en: Author/s
width: 1/2
type: text
placeholder: '{{ site.metaAuthor }}'
help:
de: Der Name der Autor\*innen der Seite. Können Personen oder eine Organisation sein.
en: The name of the author of the page. Can be an entity or a person.
metaImage:
label:
de: Bild
en: Image
width: 1/2
type: files
multiple: false
metaPhoneNumber:
width: 1/2
label:
de: Telefonnummer
en: Phone Number
icon: phone
placeholder: '{{ site.metaPhoneNumber }}'
type: text
29 changes: 0 additions & 29 deletions blueprints/fields/basic_meta.yml

This file was deleted.

Loading

1 comment on commit 4b3fff3

@MaluNoPeleke
Copy link

@MaluNoPeleke MaluNoPeleke commented on 4b3fff3 May 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobimori Any plan to document the usage of this new version or even add it as a pull request to the original one?
I would also be interested if this issue has been solved as well: diesdasdigital#24
@jonathanmuth @diesdasdigital

Please sign in to comment.