Commit 0d352e54 authored by bramtenhove's avatar bramtenhove

Initial commit containing the first release of the Yoast SEO for Drupal module on Drupal.org

parents
bower_components
node_modules
This diff is collapsed.
{
"name": "Yoast SEO for Drupal",
"homepage": "https://drupal.org/project/yoast_seo",
"authors": [
"GoalGorilla"
],
"dependencies": {
"js-text-analysis": "https://github.com/Yoast/YoastSEO.js.git#1.0-beta2"
},
"install": {
"path": {
"js": "js"
},
"sources": {
"js-text-analysis": [
"bower_components/js-text-analysis/dist/yoast-seo.min.js"
]
}
},
"description": "Yoast SEO for Drupal",
"keywords": [
"SEO",
"Drupal",
"Text analysis"
],
"license": "GPLv2"
}
#edit-yoast-seo {
border: 1px solid #ddd;
margin: 20px 0;
padding: 20px 0; }
#edit-yoast-seo .wrapper-title {
padding-left: 20px; }
#wpseo-plugin-loading {
display: block;
height: auto;
display: none; }
#edit-yoast-seo-und:after {
display: block;
content: '';
clear: both; }
#edit-yoast-seo-und .form-item {
display: inline-block;
float: left;
margin: 20px 0;
padding: 0 0 0 20px; }
#edit-yoast-seo-und #yoast-overallscore {
float: left;
padding-top: 20px;
margin-top: 20px;
margin-left: 10px; }
#yoast-overallscore {
display: inline-block; }
#yoast-overallscore .score_circle {
display: inline-block;
width: 12px;
height: 12px;
margin: 4px 5px 0 3px;
vertical-align: top;
border-radius: 50%;
background: #888; }
#yoast-overallscore.good .score_circle {
background: #7ad03a; }
#yoast-overallscore.ok .score_circle {
background: #ffba00; }
#yoast-overallscore.poor .score_circle {
background: #ee7c1b; }
#yoast-overallscore.bad .score_circle {
background: #dd3d36; }
#yoast-overallscore .score_title {
font-weight: normal; }
#yoast-overallscore .score_title strong {
font-weight: bold; }
#yoast-wrapper {
clear: both;
padding: 0 20px; }
#yoast-wrapper > label {
font-size: inherit; }
#yoast-wrapper .inputForm label {
line-height: 20px;
float: left;
width: 250px;
text-transform: capitalize;
color: #777; }
#yoast-wrapper .inputForm input {
line-height: 20px;
float: left;
width: 300px;
margin: 5px 0; }
#yoast-wrapper .inputForm textarea {
float: left;
width: 100%;
height: 400px;
margin: 5px 0; }
#yoast-wrapper li .score {
list-style-type: none; }
#yoast-wrapper .wpseoanalysis {
margin-left: 0;
list-style: none; }
#yoast-wrapper .wpseoanalysis li {
margin: 3px 0;
line-height: auto; }
#yoast-wrapper .wpseo-score-text {
display: inline-block;
width: 90%; }
#yoast-wrapper .wpseo-score-icon {
display: inline-block;
width: 12px;
height: 12px;
margin: 3px 10px 0 3px;
vertical-align: top;
border-radius: 50%;
background: #888; }
#yoast-wrapper .wpseo-score-icon.good {
background-color: #7ad03a; }
#yoast-wrapper .wpseo-score-icon.ok {
background-color: #ffba00; }
#yoast-wrapper .wpseo-score-icon.poor {
background-color: #ee7c1b; }
#yoast-wrapper .wpseo-score-icon.bad {
background-color: #dd3d36; }
#yoast-wrapper .wpseo-score-icon.na {
background-color: #999; }
#yoast-wrapper .wpseo-score-icon.noindex {
background-color: #1e8cbe; }
#yoast-wrapper .wpseo_msg {
margin: 5px 0 10px 0;
padding: 0 5px;
border: 1px solid #e6db55;
background-color: #ffffe0; }
#yoast-wrapper #snippet_preview {
font-family: Arial, sans-serif;
width: 100%;
padding: 20px;
margin: 0 0 20px; }
#yoast-wrapper .title {
font-size: 18px;
font-weight: normal;
line-height: 1.2;
display: block;
overflow: hidden;
width: 512px;
margin: 0;
white-space: nowrap;
text-decoration: none;
text-overflow: ellipsis;
color: #1e0fbe; }
#yoast-wrapper .title:visited {
color: #609; }
#yoast-wrapper .url, #yoast-wrapper .desc {
font-size: 13px;
line-height: 1.4;
display: block; }
#yoast-wrapper .url {
font-size: 14px;
font-style: normal;
line-height: 16px;
color: #006621; }
#yoast-wrapper .urlBase {
float: left; }
#yoast-wrapper .desc {
color: #545454; }
#yoast-wrapper input {
font-size: 14px;
display: block;
width: 540px;
margin: 5px 5px 5px 0;
padding: 5px; }
#yoast-wrapper textarea {
font-size: 14px;
display: block;
width: 540px;
height: 60px;
margin: 5px 5px 5px 0;
padding: 5px; }
#yoast-wrapper #snippet_preview {
font-family: Arial, sans-serif;
width: 512px;
padding: 20px;
border: 1px solid #ddd; }
#yoast-wrapper .screen-reader-text {
position: absolute !important;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
width: 1px;
height: 1px; }
#yoast-wrapper #snippet_preview:hover {
background-color: #f5f5f5; }
#yoast-wrapper #snippet_preview *[contenteditable='true']:hover {
cursor: pointer;
background: #bbdefb; }
#yoast-wrapper #snippet_preview *[contenteditable='true']:focus {
cursor: text;
background-color: #bbdefb; }
/*# sourceMappingURL=yoast_seo.css.map */
<?php
/**
* @file
* Administration page callbacks for the Yoast SEO for Drupal module.
*/
/**
* Main settings page.
*/
function yoast_seo_admin_settings_form() {
$form = array();
// Check if XML Sitemap is installed and enabled.
if (module_exists('xmlsitemap')) {
// Inform the user about altering the XML Sitemap configuration on the
// module configuration page if he has access to do so.
if (user_access('administer xmlsitemap')) {
$xmlsitemap_description = t('You can configure the XML Sitemap settings at the !url.', array('!url' => l(t('XML Sitemap configuration page'), 'admin/config/search/xmlsitemap')));
}
else {
$xmlsitemap_description = t('You do not have the permission to administer XML Sitemap.');
}
}
else {
// XML Sitemap is not enabled, inform the user he should think about
// installing and enabling it.
$xmlsitemap_description = t('You currently do not have XML Sitemap enabled. We strongly recommend you to install XML Sitemap. You can download the module from <a href="@project-page-url">@project-page-url</a>.', array('@project-page-url' => 'https://www.drupal.org/project/xmlsitemap'));
}
$form['xmlsitemap'] = array(
'#type' => 'item',
'#title' => t('XML Sitemap'),
'#markup' => $xmlsitemap_description,
);
// Inform the user about altering the Metatag configuration on the module
// configuration page if he has access to do so.
// We do not check if the module is enabled since it is our dependency.
if (user_access('administer meta tags')) {
$metatag_description = t('You can configure and override the Metatag title & description default settings at the !url.', array('!url' => l(t('Metatag configuration page'), 'admin/config/search/metatags')));
}
else {
$metatag_description = t('You currently do not have the permission to administer Metatag.');
}
$form['metatag'] = array(
'#type' => 'item',
'#title' => t('Configure Metatag default templates'),
'#markup' => $metatag_description,
);
return $form;
}
This diff is collapsed.
This diff is collapsed.
Yoast SEO for Drupal
---------------------------
Improve your Drupal SEO: Write better content and have a fully optimized Drupal content using Yoast SEO for Drupal module.
This module is written from the ground up by joined forces from [Yoast](http://www.yoast.com) and [GoalGorilla](http://www.goalgorilla.com) to improve your site's SEO on *all* needed aspects. The [Yoast SEO for Drupal module](http://drupal.org/project/yoast_seo/) is heavily dependending on the [Metatag](http://drupal.org/project/metatag) module. Together they go the extra mile to take care of a lot technical optimization, more on that below, but it first and foremost helps you write better content. Yoast SEO forces you to choose a focus keyword when you're writing your articles, and then makes sure you use that focus keyword everywhere.
Features
------------------------------------------------------------------------------
This module checks simple things you're bound to forget. It checks, for instance, whether your posts are long enough, if you've written a meta description and if that meta description contains your focus keyword, if you've used any subheadings within your post, etc. etc.
This real-time page analysis makes sure that your content is the type of content search engines will love!
Installation & configuration
------------------------------------------------------------------------------
Step by step guide on how to install and use the Yoast SEO module:
1. Download the module from http://drupal.org/project/yoast_seo or download with drush (drush dl yoast_seo).
2. Make sure to install and enable the module.
3. The metatag and yoast_seo fields will be enabled by default for your content types.
4. Make sure your user account has the "Use Yoast SEO" permission as well as the appropriate permissions for Metatag and Path.
5. Set a focus keyword, page title and description when editing a piece of content.
6. Start writing your content and get real-time feedback on it's search engine performance with page analysis.
Credits / Contact
------------------------------------------------------------------------------
First of all we want to give credit to the Metatag team! We decided to make this module a dependency for the Yoast SEO for Drupal module and not rebuild all of their excellent work.
Secondly we want to thank the Yoast team for giving us the opportunity to develop a great Drupal module in combination with their real-time page analysis solution.
Please use the Drupal issue lists to report bugs or discuss ideas on improving this module.
References
------------------------------------------------------------------------------
Yoast SEO for Drupal module
* [Yoast SEO for Drupal](http://drupal.org/project/yoast_seo)
Yoast SEO for Drupal module dependencies:
* [Metatag](http://drupal.org/project/metatag)
* Node (Core)
* Path (Core)
Yoast SEO for Drupal module libraries:
* [js-text-analysis](https://github.com/Yoast/js-text-analysis)
* [Jed](https://github.com/SlexAxton/Jed)
<?php
/**
* @file
* Hooks provided by the Yoast SEO for Drupal module.
*/
/**
* Alter the configuration sent to the content analysis library.
*
* @param array $configuration
* The array containing all the configuration options needed to let the
* content analysis library work it's magic.
*/
function hook_yoast_seo_configuration_alter(&$configuration) {
}
name = Yoast SEO for Drupal
description = "Adds Yoast SEO page analysis and configuration"
package = SEO
core = 7.x
dependencies[] = node
dependencies[] = metatag
dependencies[] = path
configure = admin/config/search/yoast
\<?php
/**
* @file
* Install, update, and uninstall functions for the Yoast SEO for Drupal module.
*/
/**
* Implements hook_requirements().
*/
function yoast_seo_requirements($phase) {
$requirements = array();
// Ensure translations don't break during installation.
$t = get_t();
// We want to make sure the correct JavaScript files have been placed in the
// libraries.
if ($phase == 'runtime') {
$requirements['yoast_seo'] = array(
'title' => $t('Yoast SEO for Drupal'),
);
// Is installed correctly?
$dependencies = _yoast_seo_requirements_getinstalledversion();
if (!in_array(NULL, $dependencies)) {
$requirements['yoast_seo'] += array(
'value' => 'Installed',
'severity' => REQUIREMENT_OK,
);
}
else {
$description = '';
foreach ($dependencies as $dependency => $version) {
if ($dependency == 'js-text-analysis' && is_null($version)) {
$description .= $t('Without the text analysis tool the Yoast SEO won\'t function properly. Please download it at <a href="@link">@link</a> and place it in the libraries folder.', array('@link' => 'https://github.com/Yoast/js-text-analysis'));
}
$description .= ' ';
}
$requirements['yoast_seo'] += array(
'value' => $t('Not found'),
'description' => $description,
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
/**
* Determines the version of the JS text analysis tool.
*/
function _yoast_seo_requirements_getinstalledversion() {
module_load_include('module', 'yoast_seo');
$dependencies = array(
'js-text-analysis' => NULL,
);
foreach ($dependencies as $dependency => $version) {
$file = '';
if ($dependency == 'js-text-analysis') {
$file = yoast_seo_library_path($dependency, 'local') . '/js/dist/yoast-seo-content-analysis.min.js';
}
$file_content = @file_get_contents($file);
if ($file_content) {
$dependencies[$dependency] = 'TBD';
}
}
return $dependencies;
}
/**
* Implements hook_schema().
*/
function yoast_seo_schema() {
$schema['yoast_seo'] = array(
'fields' => array(
'entity_type' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
'description' => 'The entity type this data is attached to.',
),
'entity_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The entity id this data is attached to.',
),
'revision_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The revision_id for the entity object this data is attached to.',
),
'language' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
'description' => 'The language of the entity.',
),
'focus_keyword' => array(
'description' => 'The focus keyword for this entity.',
'type' => 'varchar',
'length' => 512,
'not null' => FALSE,
),
'seo_status' => array(
'description' => 'The SEO status in points.',
'type' => 'int',
'unsigned' => FALSE,
),
),
'indexes' => array(
'type_revision' => array('entity_type','revision_id'),
),
'primary key' => array(
'entity_type',
'entity_id',
'revision_id',
'language',
),
);
return $schema;
}
/**
* Implements hook_install().
*
* @see metatag_install()
*/
function yoast_seo_install() {
$entity_type = 'node';
// Always enable the node entity.
variable_set('yoast_seo_enable_' . $entity_type, TRUE);
// Update each entity bundle too.
$entity_info = entity_get_info($entity_type);
if (!empty($entity_info['bundles'])) {
foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
$fields = field_info_instances($entity_type, $bundle_name);
$variable_name = 'yoast_seo_enable_' . $entity_type . '__' . $bundle_name;
// Enable Yoast SEO for Drupal when the body field is present.
if (isset($fields['body'])) {
variable_set($variable_name, TRUE);
}
else {
variable_set($variable_name, FALSE);
}
}
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment