Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/notice #32

Open
wants to merge 50 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3f88b5d
Merge pull request #1 from PlasticStudio/develop
monkeyfeet May 17, 2021
acd5dbc
Merge pull request #2 from PlasticStudio/develop
monkeyfeet May 17, 2021
4dfa28a
Merge pull request #3 from PlasticStudio/develop
monkeyfeet May 17, 2021
e0a1487
Merge pull request #4 from PlasticStudio/develop
monkeyfeet May 18, 2021
cfead5b
Merge pull request #5 from PlasticStudio/develop
monkeyfeet May 23, 2021
b55d32e
Merge pull request #6 from PlasticStudio/develop
monkeyfeet May 31, 2021
160a3c1
Merge pull request #7 from PlasticStudio/develop
monkeyfeet Jun 1, 2021
84341b4
add conditional template rendering
Nov 16, 2021
43b1eba
set default
jalamanderman Nov 16, 2021
a9ef97b
move tabs to settingsFields
jalamanderman Nov 16, 2021
816c52a
template logic for meta description
jalamanderman Nov 16, 2021
7c9ecf3
fix classname check
oscarholt Jun 15, 2022
532092c
add html sitemap page;
ebakernz Jun 19, 2022
b68c986
sitemap template
ebakernz Jun 19, 2022
e9ff38e
sitempa func
ebakernz Jun 19, 2022
6e51801
template local
ebakernz Jun 19, 2022
d30f974
include template
ebakernz Jun 19, 2022
e65134f
template updates
ebakernz Jun 20, 2022
59a3ca7
template fix
ebakernz Jun 20, 2022
6599267
template fix
ebakernz Jun 20, 2022
5599b33
remove error pgs from sitemaps
ebakernz Jun 20, 2022
4d39d47
exclude self from html sitemap
ebakernz Jun 20, 2022
f403549
remove css
ebakernz Jun 20, 2022
8523da8
filters
ebakernz Jun 20, 2022
d8f97e4
Merge pull request #8 from PlasticStudio/feature/improvements
ebakernz Jun 20, 2022
a648c42
Feature/schemas (#9)
ebakernz Sep 5, 2022
1e6e69d
adding to headtag template to give pages default metatitle (#11)
oscarholt Sep 5, 2022
f7990e3
Develop (#13)
ebakernz Nov 17, 2022
e43479e
fix variable (#14)
ebakernz Nov 17, 2022
d3d07fc
update filepath in config (#15)
oscarholt Nov 27, 2022
a601461
fixing issue
oscarholt Dec 2, 2022
0124008
patch updateSummaryFields (#16)
oscarholt Jan 16, 2023
7c87dfa
reverting patch (#17)
oscarholt Feb 1, 2023
40792ca
Feature/exclude external redirect (#18)
oscarholt May 12, 2023
d1957a6
Updating template to set default values
brad-ps Sep 17, 2023
79c47d4
Fixing conditional
brad-ps Sep 17, 2023
eae97c6
fix substr() (#19)
ebakernz Nov 14, 2023
03e0b61
fix pagemetalink() (#20)
ebakernz Jan 29, 2024
0dca7c4
Hotfix/metapreviewfield link (#21)
ebakernz Jan 29, 2024
763240a
Feature/ss5 upgrade (#22)
ebakernz Apr 2, 2024
2c905b4
Feature/ss5 upgrade (#23)
ebakernz Apr 2, 2024
6699bec
Feature/composer (#24)
ebakernz Apr 14, 2024
b047a49
Hotfix/sitemap publish (#25)
ebakernz Apr 30, 2024
a5eaf7f
Feature/ss5 trailing slash (#26)
ebakernz May 22, 2024
23657c0
Feature/ss5 trailing slash (#27)
ebakernz May 22, 2024
f95b432
Feature/sitemap page toggles (#28)
ebakernz May 23, 2024
d79fcd7
fixing updateCMSFields method to work with DataObjects (#29)
oscarholt Sep 8, 2024
4f0c8eb
fixing settings fields on dataobjects (#30)
oscarholt Sep 8, 2024
72fc251
Feature/seo improvements (#31)
ebakernz Sep 23, 2024
ba7afc7
add higher level notice, remove seo admin
ebakernz Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _config/cms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Name: seo cms config
---
SilverStripe\Admin\LeftAndMain:
extra_requirements_css:
- plasticstudio/silverstripe-seo:assets/css/seo.css
- plasticstudio/silverstripe-seo:assets/css/seo.css
3 changes: 3 additions & 0 deletions _config/extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ SilverStripe\Blog\Model\Blog:
SilverStripe\Blog\Model\BlogPost:
extensions:
- PlasticStudio\SEO\Model\Extension\SeoBlogPostExtension
SilverStripe\CMS\Model\RedirectorPage:
extensions:
- PlasticStudio\SEO\Model\Extension\SeoRedirectorPageExtension
2 changes: 1 addition & 1 deletion _config/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Name: seo meta preview config
---
PlasticStudio\SEO\Forms\MetaPreviewField:
meta_title: 'Your Meta Title Here - What Your Page is About'
meta_description: 'This is a preview of your Meta description and how it will look in the Search Engine Results Page. Always try to keep it short and make it fit into the space provided.'
meta_description: 'The meta description is empty. Create a concise summary that is unique, descriptive, and relevant to the page. Incorporate the target keywords to encourage users to click through to your site.'
52 changes: 52 additions & 0 deletions assets/css/preview-field.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

.seo-serp-preview {
height: inherit;
margin: 0;
border: 1px solid #ced5e1;
border-radius: 4px;
padding: 20px;
}

.seo-serp-url {
display: flex;
padding: 0;
padding-bottom: 0;
overflow: hidden;
align-items: center;
}

.seo-serp-url__favicon {
background-color: #f1f3f4;
border: 1px solid #dadce0;
border-radius: 50%;
display: inline-flex;
justify-content: center;
align-items: center;
height: 26px;
width: 26px;
margin-right: 12px;
flex-shrink: 0;
vertical-align: middle;
}

.seo-serp-url__title {
color: #202124;
font-size: 14px;
display: block;
line-height: 20px;
white-space: nowrap;
margin-bottom: 2px;
}

.seo-serp-title {
font-family: Arial, sans-serif;
font-size: 20px;
font-weight: 400;
color: #1a0dab;
margin: 12px 0 10px;
}

.seo-serp-description {
font-family: Arial, sans-serif;
font-size: 14px;
}
4 changes: 2 additions & 2 deletions assets/scss/seo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
border: 1px solid #b3b3b3;
padding: 7px 7px;
line-height: 16px;
margin: 0 0 20px 0;
margin: 20px;
outline: none;
background-image: none;
padding: 30px 0;
padding: 30px 20px;
width: 694px;

@include radius(0px);
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,23 @@
"homepage": "https://github.com/Andrew-Mc-Cormack"
},
{
"name": "Jeremy Cole",
"email": "jeremy@psdigital.co.nz"
"name": "PS/digital",
"email": "technical@psdigital.co.nz"
}
],
"support": {
"issues": "http://github.com/plasticstudio/silverstripe-seo/issues"
},
"require": {
"php": ">=5.6",
"silverstripe/cms": "^4.0",
"silverstripe/framework": "^4.0"
"silverstripe/cms": "^4 || ^5",
"silverstripe/framework": "^4 || ^5",
"silverstripe/vendor-plugin": "^1 || ^2"
},
"autoload": {
"psr-4": {
"CyberDuck\\SEO\\": "src/",
"CyberDuck\\SEO\\Tests\\": "tests/"
"PlasticStudio\\SEO\\": "src/",
"PlasticStudio\\SEO\\Tests\\": "tests/"
}
},
"extra": {
Expand Down
99 changes: 70 additions & 29 deletions docs/schema/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,81 @@
# Schema

This module allows you to add schema.org JSON to your webpage and auto generates schema for Blog Posts
This module allows you to add schema.org JSON to your webpage and auto generates schema for Blog Posts, Local Business, Organisation, Breadcrumbs

## Displaying Schema on Your Page
Google schema references: https://developers.google.com/search/docs/advanced/structured-data/article

Add a PageSchema template variable to your page (preferably before the closing body tag)
## Manual schemas

```html
$PageSchema
</body>
Every page apart from Blog Posts have a Settings -> Schema tab with a textarea field where you can add custom schema to that page.

## Displaying dynamic schema on Your Page

### Installation / set up

1. Add a yml to specify which schema to include where
2. In Site Settings -> SEO tab, complete site name, address, phone and lat/lng details
3. Add $ApplySchema template variable to your page (preferably before the closing body tag)

#### Example YAML

```
# Google SEO schema settings

Page:
default_image: "public/path_to_logo_file.png"
active_schema:
- 'PlasticStudio\SEO\Schema\Builder\Breadcrumbs'

Skeletor\Pages\HomePage:
active_schema:
- 'PlasticStudio\SEO\Schema\Builder\LocalBusiness'

Skeletor\Pages\NewsArticle:
active_schema:
- 'PlasticStudio\SEO\Schema\Builder\NewsArticle'
```

## Custom schema example

1. Create new schema type in app/src/Schema/Types
2. Extend PlasticStudio\SEO\Schema\Type\SchemaType
3. Write a construct method with required fields from Google Schema
4. Create a new builder module in app/src/Schema/Builder
5. Extend PlasticStudio\SEO\Schema\Builder\SchemaBuilder
6. Write a getSchema method to pull specific data for schema type
7. In yaml, specify your custom schema builder

eg: https://gist.github.com/ebakernz/1dbcb7cd229ebccf2e861dbb47729991

```
Skeletor\Artena\Models\CustomDataObjectOrPage:
active_schema:
- 'Skeletor\Schema\Builder\CustomBuilder'
```

## Auto Generated BlogPost Schema
## BlogPost Schema

The below snippet is auto generated form your BlogPost data and some site config
settings
NewsArticle schema is set up for Blog module's Blog Posts.

If you're using a custom post page, you'll need to write a custom schema, OR use the same field names (see fields pulled from blog post below).

In your CMS Site Settings -> SEO tab, add your organisation name and image to populate the data:

- publisher.name
- publisher.logo.url
- publisher.logo.width
- publisher.logo.height

The following data is pulled from the actual BlogPost:

- headline - Title
- datePublished - PublishDate
- dateModified - LastEdited
- description - Summary
- author.name - First Author FirstName and Surname
- image - FeaturedImage.URL

The below snippet is auto generated form your BlogPost data and some site config settings.

```javascript
<script type="application/ld+json">
Expand Down Expand Up @@ -49,23 +110,3 @@ settings
}
</script>
```

In your CMS settings add your organisation name and image to populate the data:

- publisher.name
- publisher.logo.url
- publisher.logo.width
- publisher.logo.height

The following data is pulled from the actual BlogPost:

- headline - Title
- datePublished - PublishDate
- dateModified - LastEdited
- description - Summary
- author.name - First Author FirstName and Surname
- image - FeaturedImage.URL

## Manually Adding Schema

Every page apart from Blog Posts have a Schema tab with a textarea field where you can add custom schema to that page.
110 changes: 55 additions & 55 deletions src/Admin/SEOAdmin.php
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
<?php

namespace PlasticStudio\SEO\Admin;
// namespace PlasticStudio\SEO\Admin;

use Page;
use Exception;
use PlasticStudio\SEO\Model\Extension\SeoExtension;
use PlasticStudio\SEO\Model\Extension\SeoPageExtension;
use SilverStripe\Admin\ModelAdmin;
// use Page;
// use Exception;
// use PlasticStudio\SEO\Model\Extension\SeoExtension;
// use PlasticStudio\SEO\Model\Extension\SeoPageExtension;
// use SilverStripe\Admin\ModelAdmin;

class SEOAdmin extends ModelAdmin
{
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
// class SEOAdmin extends ModelAdmin
// {
// public function getEditForm($id = null, $fields = null)
// {
// $form = parent::getEditForm($id, $fields);

$list = $this->getList()->sort('Priority', 'DESC');
// $list = $this->getList()->sort('Priority', 'DESC');

$grid = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
$grid->setList($list);
$grid->setModelClass($this->ClassName);
// $grid = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
// $grid->setList($list);
// $grid->setModelClass($this->ClassName);

$singleton = singleton($this->modelClass);
if ($singleton instanceof Page || is_subclass_of($singleton, Page::class)) {
if (!$singleton->hasExtension(SeoPageExtension::class)) {
throw new Exception(sprintf('%s must have the SeoPageExtension applied to work in SEO Admin', $this->modelClass));
}
} else {
if (!$singleton->hasExtension(SeoExtension::class)) {
throw new Exception(sprintf('%s must have the SeoExtension applied to work in SEO Admin', $this->modelClass));
}
}
$this->extend('updateEditForm', $form);
// $singleton = singleton($this->modelClass);
// if ($singleton instanceof Page || is_subclass_of($singleton, Page::class)) {
// if (!$singleton->hasExtension(SeoPageExtension::class)) {
// throw new Exception(sprintf('%s must have the SeoPageExtension applied to work in SEO Admin', $this->modelClass));
// }
// } else {
// if (!$singleton->hasExtension(SeoExtension::class)) {
// throw new Exception(sprintf('%s must have the SeoExtension applied to work in SEO Admin', $this->modelClass));
// }
// }
// $this->extend('updateEditForm', $form);

return $form;
}
// return $form;
// }

public function getExportFields()
{
$fields = [
'Created' => 'Created',
'ID' => 'ID',
'ClassName' => 'Class Name',
'Title' => 'Title',
'URLSegment' => 'URL Segment',
'MetaTitle' => 'Meta Title',
'MetaDescription' => 'Meta Description',
'Canonical' => 'Canonical',
'Robots' => 'Robots',
'Priority' => 'Priority',
'ChangeFrequency' => 'Change Frequency',
'SitemapHide' => 'Sitemap Hide',
'HideSocial' => 'Hide Social',
'OGtype' => 'OG Type',
'OGlocale' => 'OG Locale',
'TwitterCard' => 'Twitter Card',
'SocialImage.URL' => 'Social Image',
'HeadTags.Count' => 'Head Tags',
'SitemapImages.Count' => 'Sitemap Images'
];
$this->extend('updateExportFields', $fields);
// public function getExportFields()
// {
// $fields = [
// 'Created' => 'Created',
// 'ID' => 'ID',
// 'ClassName' => 'Class Name',
// 'Title' => 'Title',
// 'URLSegment' => 'URL Segment',
// 'MetaTitle' => 'Meta Title',
// 'MetaDescription' => 'Meta Description',
// 'Canonical' => 'Canonical',
// 'Robots' => 'Robots',
// 'Priority' => 'Priority',
// 'ChangeFrequency' => 'Change Frequency',
// 'SitemapHide' => 'Sitemap Hide',
// 'HideSocial' => 'Hide Social',
// 'OGtype' => 'OG Type',
// 'OGlocale' => 'OG Locale',
// 'TwitterCard' => 'Twitter Card',
// 'SocialImage.URL' => 'Social Image',
// 'HeadTags.Count' => 'Head Tags',
// 'SitemapImages.Count' => 'Sitemap Images'
// ];
// $this->extend('updateExportFields', $fields);

return $fields;
}
}
// return $fields;
// }
// }
Loading