From 3f8c3b5b331a78ce8c90fdf3b6a7c45a08806d8b Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Sun, 2 Jul 2017 13:56:55 +0200 Subject: [PATCH 1/4] fixed markdown syntax fails --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 96b0263..9113d80 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -SEO-Extension -============= +# SEO-Extension -###Inject SEO fields to CMS Pages, Static Pages and Blog. + +## Inject SEO fields to CMS Pages, Static Pages and Blog. This plugin add SEO fields to CMS Pages, Static Pages and Blog, and for using it you simply need to drop component on layout/page. @@ -15,22 +15,22 @@ currently included fields: __*more fields will be added on request__ -####Features +## Features * *__New__* Open Graph(og) Tags added for better sharing on social networking sites like Facebook * *__New__* Settings added in backend to configure meta and Open Graph tags -####Future +## Future * Add more fields on request. * Integration of SEO optimizer to optimize page(if possible). -####Like this plugin? +## Like this plugin? If you like this plugin, give this plugin a Like or Make donation with PayPal. -#Documentation +## Documentation -#####**Installation** +### **Installation** To install this plugin you have to click on __add to project__ or need to type __AnandPatel.SeoExtension__ in Backend *System > updates > intall plugin* @@ -39,7 +39,7 @@ The plugin currently includes three components: * SEO Blog Post * SEO Static Page -#####**SEO CMS Page** +### **SEO CMS Page** Drop this component in layout`s head section code of layout look like this @@ -56,7 +56,7 @@ code of layout look like this `````````````````` -#####**SEO Blog Post** +### **SEO Blog Post** Drop this component on CMS Page on which you have dropped blogPost Component(i.e you want to show blog post). pass parameter __data = post__ @@ -70,7 +70,7 @@ here is code of CMS page for Blog Post Page. > for using this component you must place SeoCMSPage component on layout. -#####**SEO Static Page** +### **SEO Static Page** Drop this component on Static Pages layout`s head section code of static page layout look like this @@ -88,5 +88,5 @@ code of static page layout look like this `````````````````` -####Configuration +### Configuration To configure this Plugin goto Backend *System* then find *My Settings* in left side bar, then click on *SEO Extension* , you will get Configuration options.(refer screenshots) \ No newline at end of file From a07401451002acf8c25793f6474e92d0f8163d29 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Sun, 2 Jul 2017 14:02:58 +0200 Subject: [PATCH 2/4] Updated closing tags according to the HTML5 specs --- classes/Helper.php | 12 ++++++------ components/blogpost/default.htm | 4 ++-- components/cmspage/default.htm | 14 +++++++------- components/staticpage/default.htm | 14 +++++++------- models/settings/_og_tags_description.htm | 18 ++++++++---------- 5 files changed, 30 insertions(+), 32 deletions(-) diff --git a/classes/Helper.php b/classes/Helper.php index 138f392..0480a7d 100644 --- a/classes/Helper.php +++ b/classes/Helper.php @@ -44,7 +44,7 @@ function generateCanonicalUrl() if($settings->enable_canonical_url) { - return ''; + return ''; } return ""; @@ -71,20 +71,20 @@ public function generateOgMetaTags($post) { $ogTags = ""; if($settings->og_fb_appid) - $ogTags .= '' ."\n" ; + $ogTags .= '' ."\n" ; if($settings->og_sitename) - $ogTags .= ''."\n" ; + $ogTags .= ''."\n" ; if($post->seo_description) - $ogTags .= ''."\n" ; + $ogTags .= ''."\n" ; $ogTitle = empty($post->meta_title) ? $post->title : $post->meta_title; $ogUrl = empty($post->canonical_url) ? Request::url() : $this->page->canonical_url ; - $ogTags .= ''."\n" ; + $ogTags .= ''."\n" ; - $ogTags .= ''; + $ogTags .= ''; return $ogTags; } diff --git a/components/blogpost/default.htm b/components/blogpost/default.htm index 6f72262..ac4eeeb 100644 --- a/components/blogpost/default.htm +++ b/components/blogpost/default.htm @@ -1,7 +1,7 @@ {% put meta %} {% default %} {% if post.redirect_url %} - + {% endif %} {% if post.seo_title %} @@ -19,7 +19,7 @@ {% endif %} {% if post.canonical_url %} - + {% else %} {{ '' | generateCanonicalUrl}} {% endif %} diff --git a/components/cmspage/default.htm b/components/cmspage/default.htm index 95be0b1..5ab146c 100644 --- a/components/cmspage/default.htm +++ b/components/cmspage/default.htm @@ -6,7 +6,7 @@ {% else %} {% if __SELF__.redirect_url %} - + {% endif %} {% if __SELF__.seo_title %} @@ -22,7 +22,7 @@ {% endif %} {% if __SELF__.canonical_url %} - + {% else %} {{ '' | generateCanonicalUrl}} {% endif %} @@ -32,23 +32,23 @@ {{ ''|otherMetaTags|raw }} {% if __SELF__.ogTitle %} - + {% endif %} {% if __SELF__.ogUrl %} - + {% endif %} {% if __SELF__.ogSiteName %} - + {% endif %} {% if __SELF__.ogDescription %} - + {% endif %} {% if __SELF__.ogFbAppId %} - + {% endif %} {% endif %} diff --git a/components/staticpage/default.htm b/components/staticpage/default.htm index c8734fa..a6c9a19 100644 --- a/components/staticpage/default.htm +++ b/components/staticpage/default.htm @@ -1,5 +1,5 @@ {% if __SELF__.redirect_url %} - + {% endif %} {% if __SELF__.seo_title %} @@ -17,7 +17,7 @@ {% endif %} {% if __SELF__.canonical_url %} - + {% else %} {{ '' | generateCanonicalUrl}} {% endif %} @@ -27,21 +27,21 @@ {{ ''|otherMetaTags|raw }} {% if __SELF__.ogTitle %} - + {% endif %} {% if __SELF__.ogUrl %} - + {% endif %} {% if __SELF__.ogSiteName %} - + {% endif %} {% if __SELF__.ogDescription %} - + {% endif %} {% if __SELF__.ogFbAppId %} - + {% endif %} diff --git a/models/settings/_og_tags_description.htm b/models/settings/_og_tags_description.htm index 915eb53..af9bb3a 100644 --- a/models/settings/_og_tags_description.htm +++ b/models/settings/_og_tags_description.htm @@ -1,13 +1,11 @@ What is Open Graph? -
-The Open Graph protocol enables any web page to become a rich object in a social graph. -
-
-Currently included Open Graph tags are(other tags will be added soon): +
The Open Graph protocol enables any web page to become a rich object in a social graph. +
+
Currently included Open Graph tags are(other tags will be added soon): \ No newline at end of file From 794317bd72e2952ebbaff5ed476cc775ac6fe627 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Sun, 2 Jul 2017 15:19:39 +0200 Subject: [PATCH 3/4] added og:image tag --- classes/Helper.php | 3 +++ components/CmsPage.php | 1 + components/StaticPage.php | 3 ++- components/cmspage/default.htm | 4 ++++ components/staticpage/default.htm | 4 ++++ lang/en/lang.php | 2 ++ models/BlogPost.php | 1 - models/Settings.php | 4 ---- models/settings/_og_tags_description.htm | 1 + models/settings/fields.yaml | 12 ++++++------ 10 files changed, 23 insertions(+), 12 deletions(-) diff --git a/classes/Helper.php b/classes/Helper.php index 0480a7d..01b1a4f 100644 --- a/classes/Helper.php +++ b/classes/Helper.php @@ -73,6 +73,9 @@ public function generateOgMetaTags($post) if($settings->og_fb_appid) $ogTags .= '' ."\n" ; + if($settings->og_image) + $ogTags .= '' ."\n" ; + if($settings->og_sitename) $ogTags .= ''."\n" ; diff --git a/components/CmsPage.php b/components/CmsPage.php index 06922e8..47d07d6 100644 --- a/components/CmsPage.php +++ b/components/CmsPage.php @@ -66,6 +66,7 @@ public function onRun() $this->ogUrl = empty($this->page->canonical_url) ? Request::url() : $this->page->canonical_url ; $this->ogSiteName = $settings->og_sitename; $this->ogFbAppId = $settings->og_fb_appid; + $this->ogImage = $settings->og_image; } } diff --git a/components/StaticPage.php b/components/StaticPage.php index b800c4c..a36a513 100644 --- a/components/StaticPage.php +++ b/components/StaticPage.php @@ -70,9 +70,10 @@ public function onRun() { $this->ogTitle = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title; $this->ogDescription = $this->page->meta_description; - $this->ogUrl = empty($this->page->canonical_url) ? Request::url() : $this->page->canonical_url ; + $this->ogUrl = empty($this->page->canonical_url) ? Request::url() : $this->page->canonical_url; $this->ogSiteName = $settings->og_sitename; $this->ogFbAppId = $settings->og_fb_appid; + $this->ogImage = $settings->og_image; } } diff --git a/components/cmspage/default.htm b/components/cmspage/default.htm index 5ab146c..ec30071 100644 --- a/components/cmspage/default.htm +++ b/components/cmspage/default.htm @@ -51,4 +51,8 @@ {% endif %} + {% if __SELF__.ogImage %} + + {% endif %} + {% endif %} diff --git a/components/staticpage/default.htm b/components/staticpage/default.htm index a6c9a19..cb0bab3 100644 --- a/components/staticpage/default.htm +++ b/components/staticpage/default.htm @@ -45,3 +45,7 @@ {% if __SELF__.ogFbAppId %} {% endif %} + +{% if __SELF__.ogImage %} + +{% endif %} diff --git a/lang/en/lang.php b/lang/en/lang.php index 29751e5..c2424bd 100755 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -44,6 +44,8 @@ 'sitename_comment' => 'The name of your website. Not the URL, but the name. (i.e. "SEO Extension" not "seoextension.com".)', 'fb' => 'Facebook App Id', 'fb_comment' => 'The unique ID that lets Facebook know the identity of your site.', + 'image' => 'Image', + 'image_comment' => 'Absolute image URL which should represent your object within the graph.', ], ], 'component' => [ diff --git a/models/BlogPost.php b/models/BlogPost.php index f4f96d0..e3c7ee4 100644 --- a/models/BlogPost.php +++ b/models/BlogPost.php @@ -33,7 +33,6 @@ class BlogPost extends Model public $morphTo = []; public $morphOne = []; public $morphMany = []; - public $attachOne = []; public $attachMany = []; } \ No newline at end of file diff --git a/models/Settings.php b/models/Settings.php index 4e47497..86734b8 100644 --- a/models/Settings.php +++ b/models/Settings.php @@ -16,8 +16,4 @@ class Settings extends Model{ protected $cache = []; - public $attachOne = [ - 'og_image' => ['System\Models\File'] - ]; - } \ No newline at end of file diff --git a/models/settings/_og_tags_description.htm b/models/settings/_og_tags_description.htm index af9bb3a..463a62e 100644 --- a/models/settings/_og_tags_description.htm +++ b/models/settings/_og_tags_description.htm @@ -8,4 +8,5 @@
  • og:title
  • og:url
  • og:description
  • +
  • og:image
  • \ No newline at end of file diff --git a/models/settings/fields.yaml b/models/settings/fields.yaml index b3280e1..b2eb294 100644 --- a/models/settings/fields.yaml +++ b/models/settings/fields.yaml @@ -68,9 +68,9 @@ tabs: span: left tab: anandpatel.seoextension::lang.settings.tab_og.label - - - - - - + og_image: + label: anandpatel.seoextension::lang.settings.tab_og.image + comment: anandpatel.seoextension::lang.settings.tab_og.image_comment + type: text + span: right + tab: anandpatel.seoextension::lang.settings.tab_og.label From e8c186064b896f2201877030e75f54c42e6ab14b Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Sun, 2 Jul 2017 15:28:29 +0200 Subject: [PATCH 4/4] added og:type --- classes/Helper.php | 3 +++ components/CmsPage.php | 3 ++- components/StaticPage.php | 3 ++- components/cmspage/default.htm | 4 ++++ components/staticpage/default.htm | 4 ++++ lang/en/lang.php | 2 ++ models/settings/_og_tags_description.htm | 1 + models/settings/fields.yaml | 7 +++++++ 8 files changed, 25 insertions(+), 2 deletions(-) diff --git a/classes/Helper.php b/classes/Helper.php index 01b1a4f..3e31350 100644 --- a/classes/Helper.php +++ b/classes/Helper.php @@ -76,6 +76,9 @@ public function generateOgMetaTags($post) if($settings->og_image) $ogTags .= '' ."\n" ; + if($settings->og_type) + $ogTags .= '' ."\n" ; + if($settings->og_sitename) $ogTags .= ''."\n" ; diff --git a/components/CmsPage.php b/components/CmsPage.php index 47d07d6..dfd83a2 100644 --- a/components/CmsPage.php +++ b/components/CmsPage.php @@ -26,7 +26,7 @@ class CmsPage extends ComponentBase public $ogFbAppId; public $ogLocale; public $ogImage; - + public $ogType; public function componentDetails() { @@ -67,6 +67,7 @@ public function onRun() $this->ogSiteName = $settings->og_sitename; $this->ogFbAppId = $settings->og_fb_appid; $this->ogImage = $settings->og_image; + $this->ogType = $settings->og_type; } } diff --git a/components/StaticPage.php b/components/StaticPage.php index a36a513..09ad5b6 100644 --- a/components/StaticPage.php +++ b/components/StaticPage.php @@ -25,7 +25,7 @@ class StaticPage extends ComponentBase public $ogFbAppId; public $ogLocale; public $ogImage; - + public $ogType; public function componentDetails() { @@ -74,6 +74,7 @@ public function onRun() $this->ogSiteName = $settings->og_sitename; $this->ogFbAppId = $settings->og_fb_appid; $this->ogImage = $settings->og_image; + $this->ogType = $settings->og_type; } } diff --git a/components/cmspage/default.htm b/components/cmspage/default.htm index ec30071..5e17121 100644 --- a/components/cmspage/default.htm +++ b/components/cmspage/default.htm @@ -55,4 +55,8 @@ {% endif %} + {% if __SELF__.ogType %} + + {% endif %} + {% endif %} diff --git a/components/staticpage/default.htm b/components/staticpage/default.htm index cb0bab3..a6687fe 100644 --- a/components/staticpage/default.htm +++ b/components/staticpage/default.htm @@ -49,3 +49,7 @@ {% if __SELF__.ogImage %} {% endif %} + +{% if __SELF__.ogType %} + +{% endif %} diff --git a/lang/en/lang.php b/lang/en/lang.php index c2424bd..8745327 100755 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -46,6 +46,8 @@ 'fb_comment' => 'The unique ID that lets Facebook know the identity of your site.', 'image' => 'Image', 'image_comment' => 'Absolute image URL which should represent your object within the graph.', + 'type' => 'Website type', + 'type_comment' => 'Website type descriped here http://ogp.me/#types.', ], ], 'component' => [ diff --git a/models/settings/_og_tags_description.htm b/models/settings/_og_tags_description.htm index 463a62e..7d56703 100644 --- a/models/settings/_og_tags_description.htm +++ b/models/settings/_og_tags_description.htm @@ -9,4 +9,5 @@
  • og:url
  • og:description
  • og:image
  • +
  • og:type
  • \ No newline at end of file diff --git a/models/settings/fields.yaml b/models/settings/fields.yaml index b2eb294..7e95f1a 100644 --- a/models/settings/fields.yaml +++ b/models/settings/fields.yaml @@ -74,3 +74,10 @@ tabs: type: text span: right tab: anandpatel.seoextension::lang.settings.tab_og.label + + og_type: + label: anandpatel.seoextension::lang.settings.tab_og.type + comment: anandpatel.seoextension::lang.settings.tab_og.type_comment + type: text + span: left + tab: anandpatel.seoextension::lang.settings.tab_og.label