-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ahmetcelikezer/v1.0.0
V1.0.0
- Loading branch information
Showing
12 changed files
with
774 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Ahc\TwigSeoBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
class Configuration implements ConfigurationInterface | ||
{ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder('ahc_twig_seo'); | ||
|
||
$treeBuilder->getRootNode() | ||
->children() | ||
->arrayNode('groups') | ||
->arrayPrototype() | ||
->children() | ||
->arrayNode('arguments') | ||
->scalarPrototype() | ||
->end() | ||
->end() | ||
->arrayNode('tags') | ||
->variablePrototype() | ||
->end() | ||
->end() | ||
->arrayNode('methods') | ||
->variablePrototype() | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
; | ||
|
||
return $treeBuilder; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
|
||
namespace Ahc\TwigSeoBundle\Entity; | ||
|
||
class Element | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
private $arguments; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $tags; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $methods; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $contentArray; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $group; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $argumentValues; | ||
|
||
public function __construct(string $group = null) | ||
{ | ||
$this->setGroup($group); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getGroup(): string | ||
{ | ||
return $this->group; | ||
} | ||
|
||
public function setGroup(string $group): self | ||
{ | ||
$this->group = $group; | ||
|
||
return $this; | ||
} | ||
|
||
public function getArguments(): ?array | ||
{ | ||
return $this->arguments; | ||
} | ||
|
||
public function setArguments(array $arguments): self | ||
{ | ||
$this->arguments = $arguments; | ||
|
||
return $this; | ||
} | ||
|
||
public function getArgumentValues(): ?array | ||
{ | ||
return $this->argumentValues; | ||
} | ||
|
||
public function setArgumentValues(array $values): self | ||
{ | ||
$this->argumentValues = $values; | ||
|
||
return $this; | ||
} | ||
|
||
public function getTags(): ?array | ||
{ | ||
return $this->tags; | ||
} | ||
|
||
public function setTags(array $tags): self | ||
{ | ||
$this->tags = $tags; | ||
|
||
return $this; | ||
} | ||
|
||
public function getMethods(): ?array | ||
{ | ||
return $this->methods; | ||
} | ||
|
||
public function setMethods(array $methods): self | ||
{ | ||
$this->methods = $methods; | ||
|
||
return $this; | ||
} | ||
|
||
public function getContentArray(): ?array | ||
{ | ||
return $this->contentArray; | ||
} | ||
|
||
public function setContentArray(array $content): self | ||
{ | ||
$this->contentArray = $content; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +0,0 @@ | ||
# Twig Seo Bundle | ||
This bundle includes a twig extension to print SEO meta tags easily. This is an early version of bundle, new features will be added soon. | ||
> Note: This is an early version of the extension bundle! The stable version will release soon. So next version(s) may not support this version's feature(s)! | ||
## Installation | ||
You can install this bundle with composer. | ||
```bash | ||
composer require ahc/twigseobundle | ||
``` | ||
|
||
## Methods | ||
* [Seo Base](#seo-base) | ||
* [Seo Title](#seo-title) | ||
* [Seo Description](#seo-description) | ||
* [Seo Image](#seo-image) | ||
* [Seo Page](#seo-page) | ||
### Seo Base | ||
This method print a basic tags. | ||
```twig | ||
{{ seoBase() }} | ||
``` | ||
This method includes the following tags: | ||
```html | ||
<meta property="og:type" content="website" /> | ||
``` | ||
--- | ||
### Seo Title | ||
This method print title tags with og title's. It takes only one string parameter to set the title. | ||
```twig | ||
{{ seoTitle('Your Title') }} | ||
``` | ||
This method includes the following tags: | ||
```html | ||
<title>Your Title</title> | ||
<meta property="og:site_name" content="Your Title"> | ||
<meta property="og:title" content="Your Title" /> | ||
<meta name="twitter:title" content="Your Title" /> | ||
``` | ||
--- | ||
### Seo Description | ||
This method print a description tags. It takes only one string parameter to set the description. | ||
```twig | ||
{{ seoDescription('Description text...') }} | ||
``` | ||
This method includes the following tags: | ||
```html | ||
<meta name="description" content="Description text..."> | ||
<meta property="og:description" content="Description text..." /> | ||
<meta name="twitter:description" content="Description text..." /> | ||
``` | ||
--- | ||
### Seo Image | ||
This method print the og image tags. It takes only one string parameter for set absolute image path. | ||
```twig | ||
{{ seoImage('path/image_file') }} | ||
``` | ||
> Warning! The image path must be a absolute path!! | ||
This method includes the following tags: | ||
```html | ||
<meta property="og:image" content="path/image_file" /> | ||
<meta name="twitter:image" content="path/image_file" /> | ||
<link rel="image_src" href="path/image_file" /> | ||
``` | ||
--- | ||
### Seo Page | ||
Sometimes every page has it's own meta tags. This method will set title and description of current page. It takes one array parameter including `title` and `description`. | ||
```twig | ||
{{ seoPage({ title: 'Page Title', description: 'Page Description' }) }} | ||
``` | ||
The method includes the following tags: | ||
```html | ||
<title>Page Title</title> | ||
<meta name="description" content="Page Description"> | ||
``` | ||
|
||
|
||
|
||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
ahc_twig_seo: | ||
groups: | ||
|
||
default_base: | ||
arguments: | ||
title: '%%title%%' | ||
description: '%%description%%' | ||
tags: | ||
- '<meta charset="utf-8">' | ||
- '<meta property="og:type" content="website" />' | ||
- '<meta content="IE=edge" http-equiv="X-UA-Compatible" />' | ||
- '<meta content="width=device-width, initial-scale=1" name="viewport" />' | ||
|
||
# TODO: Feature loop able groups for same data | ||
#default_favicons: | ||
# arguments: | ||
# image_path: '%%image_path%%' | ||
# size: '%%size%%' | ||
# mime_type: '%%ext%%' | ||
# tags: | ||
# - '<link rel="icon" type="%%ext%%" sizes="%%size%%" href="%%image_path%%">' | ||
|
||
default_title: | ||
arguments: | ||
title: '%%title%%' | ||
tags: | ||
- '<title>%%title%%</title>' | ||
- '<meta property="og:site_name" content="%%title%%">' | ||
- '<meta property="og:title" content="%%title%%" />' | ||
- '<meta name="twitter:title" content="%%title%%" />' | ||
|
||
default_description: | ||
arguments: | ||
description: '%%description%%' | ||
tags: | ||
- '<meta name="description" content="%%description%%" />' | ||
- '<meta property="og:description" content="%%description%%" />' | ||
- '<meta name="twitter:description" content="%%description%%" />' | ||
|
||
default_og_images: | ||
arguments: | ||
imagePath: '%%image_path%%' | ||
tags: | ||
- '<meta property="og:image" content="%%image_path%%" />' | ||
- '<meta name="twitter:image" content="%%image_path%%" />' | ||
- '<link rel="image_src" href="%%image_path%%" />' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.