Giter VIP home page Giter VIP logo

bolt-seo's Introduction

Bolt SEO extension

The Bolt SEO extension is an extension to help you improve the search engine indexing of your Bolt website in a number of ways. It does this by:

  • Allowing you to specify the SEO title and meta-description for your pages.
  • Adding meta tags to your HTML to facilitate indexing of your pages using meta tags and OG tags.
  • Override the canonical, if you really want to.
  • Set the <meta name="robots">-tag.

Installation

composer require appolodev/bolt-seo

Setup

To use this extension, you should add a field to your contenttypes, and add the tags to the header of your HMTL templates.

In your contenttypes, you should add a single seo field. The extenion will use this to store the data for the different fields that show in the backend when editing a record. Simply add it to your fields like this;

pages:
    name: Pages
    singular_name: Page
    fields:
        [..]
        seo:
            type: seo
            group: "SEO settings"

You can assign the fields their own tab, using the group: 'SEO settings', to keep them organised in the backend.

After you've done this, it will look like this in the Bolt backend:

To add the SEO title and Meta tags to your HTML, edit your templates (the 'master' or 'header') to have the following:

    <title>{{ seo.title() }}</title>
    {{ seo.metatags() }}

When you've done this, all pages that make use of these templates will automatically have the correct <title> tag and the meta- and OG-tags.

Configure the 'meta tags' output

By default, the output of the meta-tags is defined in the file vendor/appolodev/bolt-seo/templates/_metatags.twig. If you'd like to configure this output, you shouldn't edit this file directly. If you do, changes will be overwritten on subsequent updates of this extension. Instead, in /config/extensions/appolo-boltseo.yaml uncomment the following lines:

templates:
    meta: _metatags.twig

Next, copy the file _metatags.twig to your theme folder, and the extension will pick it up from there.

Note: This is a new extension, so the functionality is still pretty bare bones. What's there works well, but there is probably a lot of functionality to add, to improve search engine indexing. If you'd like to contribute, or have a good idea, feel free to open an issue on the tracker at the SEO Extension repository on Github.

Contributors

bolt-seo's People

Contributors

bobdenotter avatar fredxd avatar i-valchev avatar jamiel avatar simonmnt avatar trk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bolt-seo's Issues

When you are in contenttyle singular slug getting error

Example contenttype

categories:
    name: Categories
    singular_name: Category
    slug: categories
    singular_slug: category

When i visit: domain.ltd/categories module working
but when i visit : domain.ltd/category getting error

Ekran Resmi 2020-12-01 17 14 45

Doesn't obey meta_robots directive in appolo-boltseo.yaml

If I edit config/extensions/appolo-boltseo.yaml and change the meta_robots value (approx line 45), I would expect to see this change when doing a view source (after clearing cache), but I don't.

Whatever I enter in appolo-boltseo.yaml, the site's source code always shows index, follow.

Seo snippet description

The seo snippet doesn't work for description if i use type : redactor or article.
ex. :

body:
type: redactor

As i can see, you are listening keyup event on the textarea field, but these 2 components works with div. (Textarea field is diplay:none)

$routeType is not accurate

$this->routeType = $this->request->get('_route');

Context

When you have a routebinding (for ex. pages could have "pagebinding" for cleaner URLs) and a contenttype definition record_route defined -- as seen in the doc : https://docs.boltcms.io/5.0/routing#contenttype-overrides

Problem

The _route take the name of the binding, and $routeType is none of the switch/case (record, homepage, listing)
SEO values = default values.

Solution (tested)

A solution could be remplacing Seo.php#L68 by :
$this->routeType = explode('::', $this->request->get('_controller'))[1];
to get the controller function name, whatever the _route is.

Hope this could help.

Error in Seo.php line 165 when site doesn't have a 'payoff' configured in config.yaml

My site doesn't use a 'payoff' so in /config/bolt/config.yaml the whole payoff section is commented out.

The bolt-seo extension doesn't seem to like it as it expects a value there. It fails with :
Argument 1 passed to Appolo\BoltSeo\Seo\Seo::cleanUp() must be of the type string, null given, called in /home/user/www/example.com/vendor/appolodev/bolt-seo/src/Seo/Seo.php on line 165

Line 165 reads:
$description = $this->cleanUp($this->boltConfig->get('general/payoff'));

It makes no difference if I leave the payoff blank or comment it out altogether. The plugin expects a payoff and errors out if there is none.

SEO content appears to not persist in DB

First of all, thank you for porting this extension to Bolt 4! Great work! However, it appears that the content is not being saved to the database. Not sure what the issue could be. Can you advise?

Display in main Bolt Dashboard

Everything seems to be working great on this Bolt 4 SEO install except on the main Bolt Dashboard the display is showing actual code tags:

bolt4_seo

Faulty path to default image

I notice that if no image is defined, a not-working path is shown to an image:

<meta property="og:image" content="http://127.0.0.1:8001/files/pages/2022/06/Apollo14.jpeg" />

Support custom Record route names

Hi!

I don't know if this is already implemented but it seems not to work as I expect with the default installation.

In my use case I have defined a Contenttype with custom names for the record_route option and this seems to give some troubles to the extension to properly work.

Specially when doing this type of checks on the routeType, since the record_route option is set like record_route: content_seo (in my example) it will never match any of the cases in the switch statements in the SEO.php class. See for example

bolt-seo/src/Seo/Seo.php

Lines 263 to 272 in 4aad5ae

switch ($this->routeType) {
case 'record':
case 'homepage':
if ($this->record) {
$field = $this->getField($this->record, 'image');
if ($field && $field->__toString() !== '') {
return $this->request->getSchemeAndHttpHost().$this->cleanUp($field->__toString());
}
}
}

My contenttypes.yml

pages:
    name: Pages
    singular_name: Page
    fields:
        title:
            type: text
            class: large
            group: content
        subtitle:
            type: text
        slug:
            type: slug
            uses: title
        image:
            type: image
        content:
            type: article
        template:
            type: templateselect
            filter: '*.twig'
            default: 'page.twig'
        seo:
            type: seo
            group: "SEO settings"
    records_per_page: 50
    record_route: content_seo

What I would like to achieve is that the extension works the same as it does when there are no modifications on the record_route Contenttype option.

Is there a way to make this work?

No way to specify meta description for listing pages

Listing pages use the default description from the appolo-boltseo.yaml file (or if that is empty, the site payoff) but there doesn't seem to be a way to override this for different contenttype listings.

Edit: I tried to use the override_default option in the config file, using the contenttype as the route, but it had no effect.

Doesn't support contenttype route overrides

If I add a contenttype override in routes.yaml to hide the slug of a contenttype in URLs, something like this:

pagebinding:
  path: /{slugOrId}
  methods: [GET|POST]
  defaults:
    contentTypeSlug: page
    _controller: Bolt\Controller\Frontend\DetailController::record

I find that the seo fields (e.g. seo.title etc) are not available in my template. A dump of the seo variable reveals that the seoData property is null.

If I comment out the override in routes.yaml, and revisit the page (using the old URL containing the contenttype slug), the seoData property is populated and the fields are available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.