Coder Social home page Coder Social logo

bobdenotter / seo Goto Github PK

View Code? Open in Web Editor NEW
47.0 6.0 38.0 1.19 MB

Bolt SEO extension

Home Page: https://bobdenotter.github.io/seo/

License: MIT License

PHP 60.28% CSS 2.69% Twig 37.03%
bolt-extension bolt extension php seo meta-tags bolt-seo-extension seo-title og-tags

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.

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 extensions/vendor/bobdenotter/seo/twig/_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 /app/config/extensions/seo.bobdenotter.yml 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.

seo's People

Contributors

artggd avatar bobdenotter avatar develth avatar dfridrich avatar evertalbers avatar gwendolenlynch avatar jackbentley avatar jamiroconca avatar jasperjorna avatar michaelmackus avatar nlemoine avatar pinpickle avatar raxta avatar sahassar avatar thelovekesh avatar werner-freytag avatar xiaohutai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

seo's Issues

Default Meta Description when field is type of "repeater"

Hey there,

if the meta Description is not set on a ContentType, it outputs the following:

<meta name="description" content="Doctrine\Common\Collections\ArrayCollection@00000000611a067f00007fb879bd1fc2"/>

It seems to have a problem working together with the field type "repeater".

Field type error.

Hello,

I installed the extension and I'm having trouble getting it to work with my contenttype. I added the specified field name and type, but after saving I get the following notice: "In the contenttype for 'Home', the field 'seo' has 'type: seo', which is not a proper field type. Please edit contenttypes.yml, and correct this. "

Any help would be appreciated.

Ability to edit og:type

Hi Bob.

Can we please have the ability to edit the og:type

<meta property="og:type" content="website">

http://ogp.me/#types

Delay in data Json Generate, causes errors when saving.

I have observed a fairly long delay (3 sec), to generate the Json with seo information in the hidden field:

https://github.com/bobdenotter/seo/blob/master/twig/_seo_extension_field.twig#L213

If you perform any changes in the fields located at the bottom of page (e.g .: Meta robots tag - Shortlink alias) and quickly you click on the save button, this change is not saved.

I checked that everything works properly changing to 0 the delay value.

Why do you set that delay?

[BUG] invalid OG image tag when no image is present

Ohai!

When a contenttype contains no images at all, the extension prints
<meta property="og:image" content="http://nameofdomain.com/files/&quot;&quot;" />

Preferably, it should not print an image tag at all (ignoring for now that FB kinda requires a image tag, but that's another issue).

Thx!

SEO extension version 1.0.7

Use SEO meta description in search results

I would like to be able to use the meta description in the search results. Often pages on my website have little text (e.g. a contact page, or a page listing publications), and so the first 300 characters of the page look awful when displayed as results.

Currently, I can access the SEO data for the record with {{ record.seo }}, but this regretfully returns unparsed JSON. Is there any way around this (other than, say, using the teaser field and copy+pasting the meta description)?

[bug] - Field type

While working on a bundle that imports content in a nut command, i stumbled upon a strange issue.

I used $app['storage']->getEmptyContent('pages') and got this error:

Type error: Argument 2 passed to Doctrine\DBAL\Types\TextType::convertToPHPValue() must be an instance of Doctrine\DBAL\Platforms\AbstractPlatform, null given, called in /path/to/vendor/bolt/bolt/src/Storage/Field/Type/FieldTypeBase.php on line 123

A couple of tests later, I figured Bolt SEO was responsible for this.

Looks like extending FieldTypeBase to create a new field is causing the issue. Implementing the FieldInterface like mentioned seems to resolved the problem.

You can check the PR I submitted.

Multiple title variables (combined)

Would be great to be able to 'combine' variables from contenttypes to form a title.

Creating a realestate website now, and I need 'street' + 'houseNumber' + 'houseNumberExtension' to form a single title (with appropriate spacing).

Feature request : default fallback image

Wishlist!
It would be lovely if there would be a default image possibility. So you can, for instance, add the logo of the company in the OG tags when no image is present in the shared page.

The og:image is one of the four required properties (title, type, url and image) sauce

default:
    title: ""
    description: ""
    ogtype: "website" 
    image: "foo.jpg"

preferably like this, in the config.

Thx!


used version: 1.0.7

Missing .yml file after installation

After doing a SEO-extansion-installation, I got the error below. When inspecting with my FTP I saw that the .yml file had not been written.
I easily got rid of the error by putting the file there manually based on the .dist file, but it might be worthwhile creating this issue.

Apache, Bolt 3.1.2, PHP 7.0

If you want access to the installation that can be arranged.

BTW :-) to see the easter-egg configuration option

seo_overzicht_ bolt-_2016-09-19_09 55 35

[RFC] No more 404, 301 to new URLs

Hi,
Redirecting old URLs to new ones is a feature often demanded by SEO experts to avoid 404. It would be a nice addition to this extension.
This feature could be part of Bolt's core but I guess it'll also have to account for shortlink once it's implemented (#20). Hence I'm opening this issue here rather than on Bolt's repository.

Cheers

[FEATURE] Add option to override OG:image

I would like to be able to specify a default image to use for the OG image tag coming from the content type. So the user can upload a specifi one if needed, and the code fall back to defaults if it isn't present. Could you add it to the config? That would be nice.

like for when i have a conten type with a field "ogimage", in the config for the SEO extension I would set:

# Default values to consider for the title, meta description and meta keywords
fields:
    title: ['title', 'name']
    description: ['introduction', 'teaser', 'description', 'body']
    keywords: []
    image: ['ogimage']

thanks

Use SEO meta description in search results

I would like to be able to use the meta description in the search results. Often pages on my website have little text (e.g. a contact page, or a page listing publications), and so the first 300 characters of the page look awful when displayed as results.

Currently, I can access the SEO data for the record with {{ record.seo }}, but this regretfully returns unparsed JSON. Is there any way around this (other than, say, using the teaser field and copy+pasting the meta description)?

I'm new to Bolt and low on time at the moment, but fairly proficient with PHP. If a direction was given for me to pursue in implementing it, I might explore it if I have time.

Feature request: Hide SEO tab in backend

Lots of times I use this extension to quickly add the appropriate meta tags to my pages.
Most of the time a user simply ignores the SEO fields in the editor (because the extensions picks up content from the regular Bolt fields).
Therefore a config option like 'hide seo options in editor' would come in handy to avoid clutter in the editor.

[BUG] HTTP response printed before seo tags

Since my last composer update, calling {{ seo.metatags() }} prints the first chars of an HTTP response, like so: HTTP/1.0 200 OK Cache-Control: no-cache

I am using the following versions:

  • bolt/bolt: dev-release/3.3
  • bobdenotter/seo: v0.11.0

This seems to be due to this commit on bolt core; Bolt's render service now uses TemplateResponse instead of the former BoltResponse. TemplateResponse is meant to return an HTTP response (not an HTML bit), thus printing that string at the start of the SEO tags.

Using twigservice instead of render here would fix it. Though I shall not come with a PR because the commit causing the bug might sound like a bit of a BC break.

I let you guys decide whether it should be fixed on bolt core or this repository (or both) ๐Ÿ™‚

Can't get custom metatags template to work

Running Bolt 3.4.9 with php 5.6.
I've uncommented the

templates:
    meta: @bolt/_metatags.twig 

in the configuration file and created a custom _metatags.twig in my partials theme folder to which I added the following:

<!-- Custom Metatags -->
{% if description|default() is not empty %}
<meta name="description" content="{{ description }}"/>
{% if keywords|default() is not empty %}
<meta name="keywords" content="{{ keywords }}"/>
{% endif %}
{% endif %}
<meta property="og:locale" content="{{ htmllang()|replace({'-': '_'}) }}" />
<meta property="og:type" content="{{ ogtype|default('website') }}" />
<meta property="og:title" content="{{ title }}" />
{% if description|default() is not empty %}
<meta property="og:description" content="{{ description }}" />
{% endif %}
<meta property="og:url" content="{{ canonical }}" />
<meta property="og:site_name" content="{{ app.config.get('general/sitename') }}" />
{% if image|default() is not empty %}
<meta property="og:image" content="{{ image }}" />
{% endif %}
<meta name="robots" content="{{ robots }}" />

In my _master.twig I added "{{ seo.metatags() }}". However, the custom template is not being picked up, the default template continues to be shown. Any clues to what I am doing wrong?

Usage of the field "shortlink" ?

Hi,

Trying to get to the "shortlink" field working, and it seems not to be used anywhere in the source code. For example :

/pages/my-shortlink-url
or
/my-shortlink-url
return a 404 (no route found).

How can we use it ?
Thanks

[RFC] Add twitter:card, twitter:site and twitter:creator tags

IMHO, the twitter support in this extension is a bit lacking. For a twitter URL to use the "nice" format, Twitter appears to require or at least suggest the following:

<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@site_publisher_handle" />
<meta name="twitter:creator" content="@site_author_handle" />

See Twitter's documentation on social meta tags, as well as many others.

Robots field not retaining value

When robots field is submitted, the value is committed to database correctly and form retains selected option until you leave the add/edit page. If you go back to edit the contenttype however, the dropdown reverts to default robots value in config, regardless of database value.

Having this issue on releases compatible with Bolt 2.2 and 3.1.

Override _metatags.twig

Hi !
I am trying to override _metatags.twig by putting a copy in my theme folder, but it ignore my override.
Have I to put it in a sub folder in my theme ?
I want to do this to add a default share image when the condition "if image" is empty.
Maybe it could be an idea to add this parameter in the config file ?
best regards

can't figure out how to disable properly shortlink, canonical and robots

I tried to enable shortink, canonical and robots just for the admin.

In app/config/extensions/seo.bodenotter.yml, the default proposition is:

allow:
    shortlink: [chief-editor, admin, developper, root]
    canonical: [chief-editor, admin, developper, root]
    robots: [chief-editor, admin, developper, root]

I uncommented these lines modifying it like this:

allow:
    shortlink: [admin]
    canonical: [admin]
    robots: [admin]

But it doesn't work.

In vendor/bobdenotter/seo/templates/_seoextension_field.twig, I noticed lines 109, 123, 137 that the variables are set to seoconfig.allowed.options|default(true)

The only way I succeeded to disable canonical, robots and shortlink was to hardcode this file, deleting the default option, resulting in seoconfig.allowed.options instead of seoconfig.allowed.options|default(true) for each lines cited above.

And modifying my seo.bodenotter.yml, I did that:

allowed:
    shortlink: false
    canonical: false
    robots: false

It effectively disabled these 3 options but as I'm not a fan about hardcoding a vendor file because of the possible override after an update, I want to know if there is a better way to do that. And how is it possible to enable these options just for the admin?

Thanks for your patience and I apologize in advance if my English is incorrect, hoping you guess the meaning of my question.

Composer error when trying to install in Bolt 3.1.5

I'm not able to install this on a fresh install of Bolt 3.1.5.

When I try to install it through the Bolt Extend page by selecting version v0.11.0 and clicking "Install this version", I'm shown a Composer error that reads "Could not find package bobdenotter/seo at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability".

Is this a bug, or have I configured something incorrectly?

Thanks!

noindex per taxonomy

any way to set noindex/nofollow per taxonomy instead of for all taoxnomies?

Example:
have taxonomies: blog, products,
want: index/follow on /blog, noindex/follow on /products

current behaviour - i see it's possible to only define it for taxonomylink and contentlisting (so would work for all taxonomies at once)

Remove the random dashboard widget

I know it's fun to show a silly little gif as a way to say thank you, but it's kind of annoying to have a dashboard widget randomly popup. Additionally, it adds nothing to the functionality of the plugin.

Not to mention, if I were to use Bolt and the SEO extension to build something for a client, it'd be rather unprofessional.

Line breaks

Hi there,

Some fields are filled with content coming from textarea. I think line breaks should be removed from these strings.

Enabling extension crashes Bolt 3.6.11

Enabling this extension in ./extensions/vendor/autoload.json causes Bolt to crash with:

LogicException in Manager.php line 72:
No filesystem with mount point "theme"

Canonical Link Override non-functional

Note: disabled all other Extensions before confirming this issue. Using the latest build of Bolt (v3.3.6), and the latest build of the SEO Extension (v1.0.5)

The Canonical override variable appears to be non-functional in the majority of cases I attempted to get it working.

Screencap of variable used to override/test (and expected output):
canonicaltest

Actual output:

<head>
	<title>Title Override</title>
	<meta name="description" content="Description Override">
	<meta property="og:locale" content="en_US">
	<meta property="og:type" content="website">
	<meta property="og:title" content="Title Override">
	<meta property="og:description" content="Description Override">
	<meta property="og:url" content="http://192.168.184.143/courses/test-course-slug">
	<meta name="robots" content="noindex, follow">
	<meta name="generator" content="Bolt">
	<link rel="canonical" href="http://192.168.184.143/courses/test-course-slug">
</head>

Choose the metatags.twig template location

It would be nice if I could select where to the save metatags template, instead of the theme's default root. Generally I save it into a /partials sub-folder.

Thanks for this extension it's super useful.

Translation not loaded

Translation of the extension not working.

This one has 2 causes:

  1. bolt/bolt#5727
  2. naming of the translation files. They just should be nl.yml and not seo.nl.yml

As a content editor, I would like to be able to define my keywords in the SEO extension.

Keywords are still considered an important part of seo. Adding a field that accepts n number of comma separated keywords would be a useful addition to this extension.

This can be a single text field, requires no update to the Google Snippet and produces a single html tag as follows:

<meta name="keywords" content="<INPUT>" />

The ideal would be that this is included in the output of {{ seo.metatags() }}.

robots does not exist

after install extension i get error while create new entry

Key "robots" for array with keys "meta_robots" does not exist in "@bolt/_seo_extension_field.twig" at line 144.

i think its related on #39

License?

Just getting into Bolt, and rather than reinvent the wheel was looking at this, just wondering if the code is licensed under any OSS license?

Database exception when adding SEO type field to existing database

In Bolt v2.2.16, when I add a field of type SEO when a database (SQLite) is already present, I get the following exception:

Doctrine\DBAL\Exception\DriverException thrown with message "An exception occurred while executing 'ALTER TABLE bolt_resources ADD COLUMN seo CLOB NOT NULL':

SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL"

Stacktrace:
#18 Doctrine\DBAL\Exception\DriverException in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php:85
#17 Doctrine\DBAL\Driver\AbstractSQLiteDriver:convertException in /vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:116
#16 Doctrine\DBAL\DBALException:driverExceptionDuringQuery in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:996
#15 Bolt\Controllers\Backend:dbUpdate in <#unknown>:0
#14 Doctrine\DBAL\Driver\PDOException in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:59
#13 Bolt\Controllers\Backend:dbUpdate in <#unknown>:0
#12 PDOException in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:57
#11 PDO:exec in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:57
#10 Doctrine\DBAL\Driver\PDOConnection:exec in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:993
#9 Doctrine\DBAL\Connection:executeUpdate in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:1017
#8 Doctrine\DBAL\Schema\AbstractSchemaManager:_execSql in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:626
#7 Doctrine\DBAL\Schema\AbstractSchemaManager:alterTable in /vendor/bolt/bolt/src/Database/IntegrityChecker.php:306
#6 Bolt\Database\IntegrityChecker:repairTables in /vendor/bolt/bolt/src/Controllers/Backend.php:220
#5 Bolt\Controllers\Backend:dbUpdate in <#unknown>:0
#4 call_user_func_array in /vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:145
#3 Symfony\Component\HttpKernel\HttpKernel:handleRaw in /vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:66
#2 Symfony\Component\HttpKernel\HttpKernel:handle in /vendor/silex/silex/src/Silex/Application.php:547
#1 Silex\Application:handle in /vendor/silex/silex/src/Silex/Application.php:524
#0 Silex\Application:run in /public/index.php:35

On the latest SEO extension version

[RFC] Add ability for custom meta tag logic

I currently generate my meta tags manually with some twig logic, and for the most part it is similar to the logic in this extension, but every project does things slightly differently.

I don't know how this would be implemented, but it would be great if we could somehow provide our own ways of specifying meta tag values in the "fallback chain" of logic in this extension. For example, I may want the title to be the combination of two different fields, if they're filled, and then fall back to what the extension specifies.

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.