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

Minor changes #33

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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*


Expand All @@ -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
Expand All @@ -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__
Expand All @@ -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
Expand All @@ -88,5 +88,5 @@ code of static page layout look like this
</html>
``````````````````

####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)
18 changes: 12 additions & 6 deletions classes/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function generateCanonicalUrl()

if($settings->enable_canonical_url)
{
return '<link rel="canonical" href="'. Request::url().'"/>';
return '<link rel="canonical" href="'. Request::url().'">';
}

return "";
Expand All @@ -71,20 +71,26 @@ public function generateOgMetaTags($post)
{
$ogTags = "";
if($settings->og_fb_appid)
$ogTags .= '<meta property="fb:app_id" content="'.$settings->og_fb_appid.'" />' ."\n" ;
$ogTags .= '<meta property="fb:app_id" content="'.$settings->og_fb_appid.'">' ."\n" ;

if($settings->og_image)
$ogTags .= '<meta property="og:image" content="'.$settings->og_image.'">' ."\n" ;

if($settings->og_type)
$ogTags .= '<meta property="og:type" content="'.$settings->og_type.'">' ."\n" ;

if($settings->og_sitename)
$ogTags .= '<meta property="og:site_name" content="'.$settings->og_sitename .'" />'."\n" ;
$ogTags .= '<meta property="og:site_name" content="'.$settings->og_sitename .'">'."\n" ;

if($post->seo_description)
$ogTags .= '<meta property="og:description" content="'.$post->seo_description.'" />'."\n" ;
$ogTags .= '<meta property="og:description" content="'.$post->seo_description.'">'."\n" ;

$ogTitle = empty($post->meta_title) ? $post->title : $post->meta_title;
$ogUrl = empty($post->canonical_url) ? Request::url() : $this->page->canonical_url ;

$ogTags .= '<meta property="og:title" content="'. $ogTitle .'" />'."\n" ;
$ogTags .= '<meta property="og:title" content="'. $ogTitle .'">'."\n" ;

$ogTags .= '<meta property="og:url" content="'. $ogUrl .'" />';
$ogTags .= '<meta property="og:url" content="'. $ogUrl .'">';

return $ogTags;
}
Expand Down
4 changes: 3 additions & 1 deletion components/CmsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CmsPage extends ComponentBase
public $ogFbAppId;
public $ogLocale;
public $ogImage;

public $ogType;

public function componentDetails()
{
Expand Down Expand Up @@ -66,6 +66,8 @@ 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;
$this->ogType = $settings->og_type;
}

}
Expand Down
6 changes: 4 additions & 2 deletions components/StaticPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StaticPage extends ComponentBase
public $ogFbAppId;
public $ogLocale;
public $ogImage;

public $ogType;

public function componentDetails()
{
Expand Down Expand Up @@ -70,9 +70,11 @@ 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;
$this->ogType = $settings->og_type;
}
}

Expand Down
4 changes: 2 additions & 2 deletions components/blogpost/default.htm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% put meta %}
{% default %}
{% if post.redirect_url %}
<meta http-equiv="refresh" content="0; url={{post.redirect_url}}" />
<meta http-equiv="refresh" content="0; url={{post.redirect_url}}">
{% endif %}

{% if post.seo_title %}
Expand All @@ -19,7 +19,7 @@
{% endif %}

{% if post.canonical_url %}
<link rel="canonical" href="{{post.canonical_url}}" />
<link rel="canonical" href="{{post.canonical_url}}">
{% else %}
{{ '' | generateCanonicalUrl}}
{% endif %}
Expand Down
22 changes: 15 additions & 7 deletions components/cmspage/default.htm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% else %}

{% if __SELF__.redirect_url %}
<meta http-equiv="refresh" content="0; url={{__SELF__.redirect_url}}" />
<meta http-equiv="refresh" content="0; url={{__SELF__.redirect_url}}">
{% endif %}

{% if __SELF__.seo_title %}
Expand All @@ -22,7 +22,7 @@
{% endif %}

{% if __SELF__.canonical_url %}
<link rel="canonical" href="{{__SELF__.canonical_url}}" />
<link rel="canonical" href="{{__SELF__.canonical_url}}">
{% else %}
{{ '' | generateCanonicalUrl}}
{% endif %}
Expand All @@ -32,23 +32,31 @@
{{ ''|otherMetaTags|raw }}

{% if __SELF__.ogTitle %}
<meta property="og:title" content="{{ __SELF__.ogTitle }}" />
<meta property="og:title" content="{{ __SELF__.ogTitle }}">
{% endif %}

{% if __SELF__.ogUrl %}
<meta property="og:url" content="{{ __SELF__.ogUrl }}" />
<meta property="og:url" content="{{ __SELF__.ogUrl }}">
{% endif %}

{% if __SELF__.ogSiteName %}
<meta property="og:site_name" content="{{ __SELF__.ogSiteName }}" />
<meta property="og:site_name" content="{{ __SELF__.ogSiteName }}">
{% endif %}

{% if __SELF__.ogDescription %}
<meta property="og:description" content="{{ __SELF__.ogDescription }}" />
<meta property="og:description" content="{{ __SELF__.ogDescription }}">
{% endif %}

{% if __SELF__.ogFbAppId %}
<meta property="fb:app_id" content="{{ __SELF__.ogFbAppId }}" />
<meta property="fb:app_id" content="{{ __SELF__.ogFbAppId }}">
{% endif %}

{% if __SELF__.ogImage %}
<meta property="og:image" content="{{ __SELF__.ogImage }}">
{% endif %}

{% if __SELF__.ogType %}
<meta property="og:type" content="{{ __SELF__.ogType }}">
{% endif %}

{% endif %}
22 changes: 15 additions & 7 deletions components/staticpage/default.htm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if __SELF__.redirect_url %}
<meta http-equiv="refresh" content="0; url={{__SELF__.redirect_url}}" />
<meta http-equiv="refresh" content="0; url={{__SELF__.redirect_url}}">
{% endif %}

{% if __SELF__.seo_title %}
Expand All @@ -17,7 +17,7 @@
{% endif %}

{% if __SELF__.canonical_url %}
<link rel="canonical" href="{{__SELF__.canonical_url}}" />
<link rel="canonical" href="{{__SELF__.canonical_url}}">
{% else %}
{{ '' | generateCanonicalUrl}}
{% endif %}
Expand All @@ -27,21 +27,29 @@
{{ ''|otherMetaTags|raw }}

{% if __SELF__.ogTitle %}
<meta property="og:title" content="{{ __SELF__.ogTitle }}" />
<meta property="og:title" content="{{ __SELF__.ogTitle }}">
{% endif %}

{% if __SELF__.ogUrl %}
<meta property="og:url" content="{{ __SELF__.ogUrl }}" />
<meta property="og:url" content="{{ __SELF__.ogUrl }}">
{% endif %}

{% if __SELF__.ogSiteName %}
<meta property="og:site_name" content="{{ __SELF__.ogSiteName }}" />
<meta property="og:site_name" content="{{ __SELF__.ogSiteName }}">
{% endif %}

{% if __SELF__.ogDescription %}
<meta property="og:description" content="{{ __SELF__.ogDescription }}" />
<meta property="og:description" content="{{ __SELF__.ogDescription }}">
{% endif %}

{% if __SELF__.ogFbAppId %}
<meta property="fb:app_id" content="{{ __SELF__.ogFbAppId }}" />
<meta property="fb:app_id" content="{{ __SELF__.ogFbAppId }}">
{% endif %}

{% if __SELF__.ogImage %}
<meta property="og:image" content="{{ __SELF__.ogImage }}">
{% endif %}

{% if __SELF__.ogType %}
<meta property="og:type" content="{{ __SELF__.ogType }}">
{% endif %}
4 changes: 4 additions & 0 deletions lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
'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.',
'type' => 'Website type',
'type_comment' => 'Website type descriped here http://ogp.me/#types.',
],
],
'component' => [
Expand Down
1 change: 0 additions & 1 deletion models/BlogPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class BlogPost extends Model
public $morphTo = [];
public $morphOne = [];
public $morphMany = [];
public $attachOne = [];
public $attachMany = [];

}
4 changes: 0 additions & 4 deletions models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@ class Settings extends Model{

protected $cache = [];

public $attachOne = [
'og_image' => ['System\Models\File']
];

}
20 changes: 10 additions & 10 deletions models/settings/_og_tags_description.htm
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<b>What is Open Graph?</b>
<br/>
The Open Graph protocol enables any web page to become a rich object in a social graph.
<br/>
<br/>
Currently included Open Graph tags are(other tags will be added soon):
<br> The Open Graph protocol enables any web page to become a rich object in a social graph.
<br>
<br> Currently included Open Graph tags are(other tags will be added soon):
<ul>
<li>fb:app_id</li>
<li>og:site_name</li>
<li>og:title</li>
<li>og:url</li>
<li>og:description</li>
<li>fb:app_id</li>
<li>og:site_name</li>
<li>og:title</li>
<li>og:url</li>
<li>og:description</li>
<li>og:image</li>
<li>og:type</li>
</ul>
19 changes: 13 additions & 6 deletions models/settings/fields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,16 @@ 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

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