View source
<?php
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
const SEO_CHECKLIST_GA_QUERY_STRING = 'utm_source=seo_checklist&utm_medium=backend&utm_content=logo&utm_campaign=volacci_seo';
function seo_checklist_checklistapi_checklist_info() : array {
$definitions = [];
$definitions['seo_checklist'] = [
'#title' => t('SEO checklist'),
'#description' => t('Keep track of your Drupal Search Engine Optimization tasks.'),
'#path' => '/admin/config/search/seo-checklist',
'#callback' => 'seo_checklist_checklistapi_checklist_items',
'#help' => t("<p>Check off each SEO-related task as you complete it. Don't forget to click the <em>Save</em> button!</p>"),
];
return $definitions;
}
function seo_checklist_checklistapi_checklist_items() : array {
$renderer = \Drupal::service('renderer');
$getting_started = [
'#theme' => 'seo_checklist_getting_started',
];
$items = [
'getting_started' => [
'#title' => t('Getting started'),
'#description' => $renderer
->renderPlain($getting_started),
],
'be_efficient' => [
'#title' => t('Be efficient'),
'#description' => t('While not strictly necessary for SEO, these tasks will set you up to get things done much quicker.'),
'install_and_enable_seo_checklist_module' => [
'#title' => t('Install and Enable SEO Checklist module'),
'#description' => t('The Drupal SEO Checklist uses Drupal SEO best practices to check your website for proper search engine optimization.'),
'#book_ref' => [
'#chapter' => 2,
'#page' => 19,
],
'#seo_guide' => [
'#title' => t('SEO Checklist'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/drupal-seo-checklist-module',
],
'configure_permissions' => [
'#text' => 'Configure permissions',
'#url' => Url::fromRoute('user.admin_permissions', [], [
'fragment' => "module-checklist-api",
]),
],
],
'install_and_enable_coffee_module' => [
'#title' => t('[Optional] Install and Enable Coffee module'),
'#description' => t('The Coffee module helps you to navigate through the Drupal admin faster, inspired by Mac apps Alfred and Spotlight.'),
'#book_ref' => [
'#chapter' => 2,
'#page' => 27,
],
'#seo_guide' => [
'#title' => t('Coffee Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/coffee-module',
],
'#module' => 'coffee',
'#seo_training_camp' => Url::fromUri('https://dev.acquia.com/blog/drupal-8-module-week-coffee'),
'#configure' => 'coffee.configuration',
],
'configure_coffee_module' => [
'#title' => t('[Optional] Configure Coffee module'),
'#description' => t('Set up which menus Coffee will display.'),
'#book_ref' => [
'#chapter' => 2,
'#page' => 31,
],
'#seo_guide' => [
'#title' => t('Coffee Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/coffee-module',
],
'#configure' => 'coffee.configuration',
],
'install_and_enable_admin_toolbar_module' => [
'#title' => t('[Optional] Install and Enable Admin Toolbar module'),
'#description' => t('Provides quicker access to administration pages by adding drop-down and pull-out menus to the Drupal admin toolbar.'),
'#book_ref' => [
'#chapter' => 2,
'#page' => 35,
],
'#seo_guide' => [
'#title' => t('Admin Toolbar Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/admin-toolbar-module',
],
'#module' => 'admin_toolbar',
'#seo_training_camp' => Url::fromUri('https://dev.acquia.com/blog/drupal-8-module-of-the-week/drupal-8-module-of-the-week-admin-toolbar'),
],
'install_composer_command_line_tool' => [
'#title' => t('[Optional] Install Composer command line tool'),
'#description' => t('Composer is the package manager for PHP. It installs modules and keeps a configuration file for faster deployment.'),
'#book_ref' => [
'#chapter' => 1,
],
'project_page' => [
'#text' => t('Download'),
'#url' => Url::fromUri('https://getcomposer.org/'),
],
],
'install_drush_command_line_tool' => [
'#title' => t('[Optional] Install Drush command line tool'),
'#description' => t('Drush is a command line tool for Drupal that you can use, among other things, to install modules faster.'),
'#book_ref' => [
'#chapter' => 1,
],
'#seo_training_camp' => Url::fromUri('http://docs.drush.org/en/master/'),
'project_page' => [
'#text' => t('Download'),
'#url' => Url::fromUri('http://docs.drush.org/en/master/install/'),
],
],
'show_cli_commands' => [
'#title' => t('[Optional] Check here to show suggested Composer and Drush commands in SEO Checklist item descriptions.'),
],
],
'basic_seo_part_1' => [
'#title' => t('Basic SEO part 1 - Clean URLs'),
'#description' => t('Clean, well-formed URLs are the foundation of search engine optimization.'),
'enable_clean_urls' => [
'#title' => t('Enable clean URLs.'),
'#description' => t('Clean URLs remove query strings from Drupal paths which improves SEO.'),
'#book_ref' => [
'#chapter' => 3,
'#page' => 37,
],
'#seo_guide' => [
'#title' => t('Enable Clean URLs'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/clean-urls',
],
],
'install_and_enable_redirect_module' => [
'#title' => t('Install and Enable Redirect module'),
'#description' => t('Redirects visitors from old URLs to new URLs.'),
'#book_ref' => [
'#chapter' => 3,
'#page' => 41,
],
'#seo_guide' => [
'#title' => t('Redirect Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/redirect-module',
],
'#module' => 'redirect',
],
'configure_the_redirect_module' => [
'#title' => t('Configure the Redirect module'),
'#description' => t('Tweak redirect settings for maximum benefit.'),
'#book_ref' => [
'#chapter' => 3,
'#page' => 43,
],
'#seo_guide' => [
'#title' => t('Redirect Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/redirect-module',
],
'#configure' => 'redirect.settings',
],
'install_and_enable_pathauto_module' => [
'#title' => t('Install and Enable Pathauto module'),
'#description' => t('Automatically generates URL/path aliases for various kinds of content without requiring the user to manually specify the path alias.'),
'#book_ref' => [
'#chapter' => 3,
'#page' => 48,
],
'#seo_guide' => [
'#title' => t('Pathauto Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/pathauto-module',
],
'#module' => 'pathauto',
],
'configure_pathauto_module' => [
'#title' => t('Configure Pathauto module'),
'#description' => t('Defaults are usually OK for most sites.'),
'#book_ref' => [
'#chapter' => 3,
'#page' => 50,
],
'#seo_guide' => [
'#title' => t('Pathauto Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/pathauto-module',
],
'#configure' => 'pathauto.settings.form',
],
'create_pathauto_patterns' => [
'#title' => t('Create Pathauto patterns'),
'#description' => t('Specify a pattern that Drupal will use to create the path name for a new piece of content.'),
'#book_ref' => [
'#chapter' => 3,
],
'#seo_guide' => [
'#title' => t('Pathauto Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/pathauto-module',
],
'#configure' => 'entity.pathauto_pattern.collection',
],
'install_and_enable_file_field_paths_module' => [
'#title' => t('Install and Enable File (Field) Paths module'),
'#description' => t('The File (Field) Paths module extends the default functionality of the Drupal core File module.'),
'#seo_guide' => [
'#title' => t('File (Field) Paths Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/file-field-paths-module',
],
'#module' => 'filefield_paths',
],
'configure_file_field_paths_module' => [
'#title' => t('Configure File (Field) Paths module'),
'#description' => t('The File (Field) Paths module extends the default functionality of the Drupal core File module.'),
'#seo_guide' => [
'#title' => t('File (Field) Paths Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/file-field-paths-module',
],
'#configure' => 'entity.node_type.collection',
],
],
'basic_seo_part_2' => [
'#title' => t('Basic SEO part 2 - Meta tags'),
'#description' => t('Search engines look at your <code>TITLE</code> tags and certain meta data to determine what your site is about. These modules give you control over this important information.'),
'install_and_enable_metatag_module' => [
'#title' => t('Install and Enable Metatag module'),
'#description' => t('Provides structured metadata, aka "meta tags", about a website.'),
'#book_ref' => [
'#chapter' => 4,
'#page' => 64,
],
'#seo_guide' => [
'#title' => t('Metatag Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/metatag-module',
],
'#module' => 'metatag',
'#seo_training_camp' => Url::fromUri('https://dev.acquia.com/blog/drupal-8-module-of-the-week-metatag/17/02/2016/9716'),
],
'install_and_enable_schema_metatag' => [
'#title' => t('Install and Enable Schema Metatag module'),
'#description' => t('Extends the Metatag module to display structured data as JSON LD in the head of web pages. Install the appropriate sub-modules to add corresponding functionality for configuration in the next step.'),
'#module' => 'schema_metatag',
'test' => [
'#text' => t('Lullabot Blog Post'),
'#url' => Url::fromUri('https://www.lullabot.com/articles/create-seo-juice-by-adding-json-ld-structured-data-to-drupal-8'),
'#weight' => 5,
],
],
'set_metatags_for_your_site' => [
'#title' => t('Set Metatags for your site'),
'#description' => t('Set up the metatags for your content.'),
'#book_ref' => [
'#chapter' => 4,
'#page' => 67,
],
'#seo_guide' => [
'#title' => t('Metatag Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/metatag-module',
],
'#configure' => 'entity.metatag_defaults.collection',
],
'install_and_enable_alternate_hreflang_module' => [
'#title' => t('Install and Enable Alternate hreflang module'),
'#description' => t('Automatically adds hreflang tags to your pages.'),
'#book_ref' => [
'#chapter' => 4,
'#page' => 88,
],
'#seo_guide' => [
'#title' => t('Hreflang Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/hreflang-module',
],
'#module' => 'hreflang',
'#seo_training_camp' => Url::fromUri('https://support.google.com/webmasters/answer/189077'),
],
],
'search_engines' => [
'#title' => t('Search engines'),
'#description' => t('Set your site up with the search engines and submit your XML sitemap.'),
'install_and_enable_xml_sitemap_module' => [
'#title' => t('Install and Enable XML Sitemap module'),
'#description' => t('Creates an XML Sitemap of your content that you can submit to the search engines. (For an alternative to the XML Sitemap module, consider <a href=":url">Simple XML sitemap</a>.)', [
':url' => 'https://www.drupal.org/project/simple_sitemap',
]),
'#module' => 'xmlsitemap',
'#book_ref' => [
'#chapter' => 5,
'#page' => 96,
],
'#seo_guide' => [
'#title' => t('XML Sitemap Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/xml-sitemap-module',
],
],
'configure_xml_sitemap_module' => [
'#title' => t('Configure XML Sitemap module'),
'#description' => t('Set up the entities that will appear in the XML Sitemap.'),
'#book_ref' => [
'#chapter' => 5,
'#page' => 98,
],
'#seo_guide' => [
'#title' => t('XML Sitemap Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/xml-sitemap-module',
],
'#configure' => 'xmlsitemap.admin_settings',
],
'install_and_enable_robotstxt_module' => [
'#title' => t('Install and Enable RobotsTxt module'),
'#description' => t('Gives you the ability to edit your robots.txt file within the Drupal interface and manage multi-site sitemaps.'),
'#seo_guide' => [
'#title' => t('RobotsTxt Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/robotstxt-module',
],
'#module' => 'robotstxt',
],
'add_xml_sitemap_to_your_robotstxt_file' => [
'#title' => t('Add XML Sitemap to your robots.txt file'),
'#description' => t('Makes your XML sitemap findable by other search engines.'),
'#book_ref' => [
'#chapter' => 5,
'#page' => 119,
],
'#seo_guide' => [
'#title' => t('RobotsTxt Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/robotstxt-module#addxmlsitemap',
],
],
'set_up_cron' => [
'#title' => t('Set up Cron'),
'#description' => t('Set up cron to run periodically so that your XML sitemap will be updated.'),
'#book_ref' => [
'#chapter' => 5,
'#page' => 104,
],
'#seo_guide' => [
'#title' => t('Set up Cron'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/cron',
],
],
'google_accounts_sign_ups' => [
'#title' => t('Google Accounts Sign Ups'),
'#description' => t('Sign up for all the necessary Google accounts that will allow the most accurate analytics tracking for your website.'),
'#seo_guide' => [
'#title' => t('Google Tracking Submission'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/google-tracking-site-submission#acctsignup',
],
],
'install_and_enable_google_tag_manager_module' => [
'#title' => t('Install and Enable Google Tag Manager Module'),
'#description' => t('Makes setting up your Google Analytics easy and provides the ability to install additional 3rd party scripts and to track visitor activity that is not included with a base Google Analytics installation. (For an alternative to Google Analytics, consider <a href=":url">Matomo Analytics</a>.)', [
':url' => 'https://www.drupal.org/project/matomo',
]),
'#seo_guide' => [
'#title' => t('Google Tracking Submission'),
'#url' => 'https://www.volacci.com/blog/installing-google-tag-manager-analytics-search-console-drupal-9#install',
],
'#module' => 'google_tag',
],
'configure_google_tag_manager_module' => [
'#title' => t('Configure Google Tag Manager Module'),
'#description' => t('Use the Google Tag Manager module to install Google Analytics on your website.'),
'#seo_guide' => [
'#title' => t('Google Tracking Submission'),
'#url' => t('https://www.volacci.com/drupal-seo-guide/google-tracking-site-submission#gtmconfig'),
],
'#configure' => 'entity.google_tag_container.collection',
],
'submit_xml_sitemap_to_google' => [
'#title' => t('Submit XML sitemap to Google'),
'#description' => t('Gives Google a list of all the content on your website.'),
'#book_ref' => [
'#chapter' => 5,
'#page' => 111,
],
'#seo_guide' => [
'#title' => t('Submit XML sitemap to Google'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/google-tracking-site-submission#xmlsitemap',
],
'#configure' => 'entity.google_tag_container.collection',
'submit_xml_sitemap' => [
'#text' => t('Submit XML sitemap'),
'#url' => Url::fromUri('https://www.google.com/webmasters/tools/sitemap-list'),
],
],
'get_a_microsoft_account' => [
'#title' => t('Get a Microsoft account'),
'#description' => t('A Microsoft account gives you access to Bing Webmaster Tools.'),
'#book_ref' => [
'#chapter' => 5,
'#page' => 113,
],
'create_microsoft_account' => [
'#text' => t('Create Microsoft account'),
'#url' => Url::fromUri('https://signup.live.com/'),
],
],
'authenticate_with_bing' => [
'#title' => t('Authenticate with Bing'),
'#description' => t('Authenticate your ownership of your website with Bing.'),
'#book_ref' => [
'#chapter' => 5,
'#page' => 114,
],
'bing_webmaster_tools' => [
'#text' => t('Bing Webmaster Tools'),
'#url' => Url::fromUri('https://www.bing.com/webmaster/home/'),
],
],
'submit_xml_sitemap_to_bing' => [
'#title' => t('Submit XML sitemap to Bing'),
'#description' => t('Gives Bing a list of all the content on your website.'),
'#book_ref' => [
'#chapter' => 5,
'#page' => 114,
],
'bing_webmaster_tools' => [
'#text' => t('Bing Webmaster Tools'),
'#url' => Url::fromUri('https://www.bing.com/webmaster/home/'),
],
],
],
'optimizing_content' => [
'#title' => t('Optimizing content'),
'#description' => t('Well-written and optimized content is important to the search engines and your visitors.'),
'install_and_enable_easy_breadcrumbs_module' => [
'#title' => t('Install and Enable Easy Breadcrumbs module'),
'#description' => t('Easy Breadcrumb uses the current URL (path alias) and the current page title to automatically create breadcrumbs.'),
'#book_ref' => [
'#chapter' => 6,
'#page' => 136,
],
'#seo_guide' => [
'#title' => t('Easy Breadcrumb Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/easy-breadcrumb-module',
],
'#module' => 'easy_breadcrumb',
],
'configure_easy_breadcrumbs_module' => [
'#title' => t('Configure Easy Breadcrumbs module'),
'#description' => t('Set front page breadcrumb and other options.'),
'#book_ref' => [
'#chapter' => 6,
'#page' => 137,
],
'#seo_guide' => [
'#title' => t('Easy Breadcrumb Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/easy-breadcrumb-module',
],
'#configure' => 'easy_breadcrumb.general_settings_form',
],
'install_and_enable_d8_editor_advanced_link_module' => [
'#title' => t('Install and Enable Editor Advanced link module'),
'#description' => t('Allows you to define title, class, id, target, and rel for links in CKEditor.'),
'#book_ref' => [
'#chapter' => 6,
'#page' => 161,
],
'#seo_guide' => [
'#title' => t('Editor Advanced Link Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/editor-advanced-link-module',
],
'#module' => 'editor_advanced_link',
],
'configure_text_formats_to_use_d8_editor_advanced_link_module' => [
'#title' => t('Configure Text formats to use D8 Editor Advanced link module'),
'#description' => t('Set up CKEditor to use the D8 Editor Advanced link module'),
'#book_ref' => [
'#chapter' => 6,
'#page' => 162,
],
'#seo_guide' => [
'#title' => t('Editor Advanced Link Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/editor-advanced-link-module',
],
'#configure' => 'filter.admin_overview',
],
'install_and_enable_sitemap_module' => [
'#title' => t('Install and Enable Sitemap module'),
'#description' => t('This module provides a site map that gives visitors an overview of your site. It can also display the RSS feeds for all blogs and categories.'),
'#book_ref' => [
'#chapter' => 7,
'#page' => 175,
],
'#seo_guide' => [
'#title' => t('Sitemap Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/sitemap-module',
],
'#module' => 'sitemap',
],
'configure_sitemap_module' => [
'#title' => t('Configure Sitemap module'),
'#description' => t('Name and enable content of your sitemap.'),
'#book_ref' => [
'#chapter' => 7,
'#page' => 177,
],
'#seo_guide' => [
'#title' => t('Sitemap Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/sitemap-module',
],
'#module' => 'sitemap',
'#configure' => 'sitemap.settings',
],
'install_and_enable_search_404_module' => [
'#title' => t('Install and Enable Search 404 module'),
'#description' => t('Performs a search on the keywords in the URL instead of showing a standard "404 Page not found".'),
'#book_ref' => [
'#chapter' => 7,
'#page' => 181,
],
'#seo_guide' => [
'#title' => t('Search 404 Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/search-404-module',
],
'#module' => 'search404',
],
'configure_search_404_module' => [
'#title' => t('Configure Search 404 module'),
'#description' => t('Set up how Search 404 responds to visitors.'),
'#book_ref' => [
'#chapter' => 7,
'#page' => 182,
],
'#seo_guide' => [
'#title' => t('Search 404 Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/search-404-module',
],
'#configure' => 'search404.settings',
],
],
'page_optimization' => [
'#title' => t('On-page optimization'),
'#description' => t('Optimize each page of your website for optimal results.'),
'install_and_enable_yoast_seo_module' => [
'#title' => t('Install and Enable Real-time SEO for Drupal module'),
'#description' => t('Helps you optimize content around keywords in a natural, non-spam way.'),
'#book_ref' => [
'#chapter' => 8,
'#page' => 189,
],
'#seo_guide' => [
'#title' => t('Real-time SEO for Drupal Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/real-time-seo-drupal-module',
],
'#module' => 'yoast_seo',
],
'configure_yoast_seo_module' => [
'#title' => t('Configure Real-time SEO for Drupal Module'),
'#description' => t('Set up which content types the Real-time SEO for Drupal module will evaluate.'),
'#book_ref' => [
'#chapter' => 8,
'#page' => 190,
],
'#seo_guide' => [
'#title' => t('Real-time SEO for Drupal Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/real-time-seo-drupal-module',
],
'#configure' => 'yoast_seo.settings',
],
'turn_on_create_new_revisions_for_all_content' => [
'#title' => t('Turn on Create New Revisions for all content types'),
'#description' => t('Helps you figure out what changes increased or decreased rankings.'),
'#book_ref' => [
'#chapter' => 8,
'#page' => 196,
],
'#seo_guide' => [
'#title' => t('The Diff Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/diff-module',
],
'#configure' => 'filter.admin_overview',
],
'install_and_enable_diff_module' => [
'#title' => t('Install and Enable Diff module'),
'#description' => t('Shows you differences between revisions to nodes.'),
'#book_ref' => [
'#chapter' => 8,
'#page' => 198,
],
'#seo_guide' => [
'#title' => t('The Diff Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/diff-module',
],
'#module' => 'diff',
],
'configure_the_diff_module' => [
'#title' => t('Configure the Diff module'),
'#description' => t('Configure how the diff module displays differences in your content.'),
'#book_ref' => [
'#chapter' => 8,
'#page' => 198,
],
'#seo_guide' => [
'#title' => t('The Diff Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/diff-module',
],
'#module' => 'diff',
'#configure' => 'diff.general_settings',
],
'install_and_enable_scheduler_module' => [
'#title' => t('Install and Enable Scheduler module'),
'#description' => t('Scheduler gives content editors the ability to schedule nodes to be published and unpublished at specified dates and times in the future.'),
'#book_ref' => [
'#chapter' => 8,
'#page' => 204,
],
'#seo_guide' => [
'#title' => t('Scheduler Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/scheduler-module',
],
'#module' => 'scheduler',
],
'configure_the_scheduler_module' => [
'#title' => t('Configure the Scheduler module.'),
'#description' => t('Set up how the Scheduler module displays dates and publishes content.'),
'#book_ref' => [
'#chapter' => 8,
'#page' => 207,
],
'#seo_guide' => [
'#title' => t('Scheduler Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/scheduler-module',
],
'#configure' => 'scheduler.admin_form',
],
],
'security_and_performance' => [
'#title' => t('Security and performance'),
'#description' => t("The best SEO'd website will not perform well if it is slow, gets hacked, or is spammed. Take these steps to lock things down and speed them up."),
'install_and_enable_security_review_module' => [
'#title' => t('Install and Enable Security Review module'),
'#description' => t('The Security Review module automates testing for many of the easy-to-make mistakes that render your site insecure.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 215,
],
'#seo_guide' => [
'#title' => t('Security Review Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/security-review-module',
],
'#module' => 'security_review',
],
'configure_security_review_module' => [
'#title' => t('Configure Security Review module'),
'#description' => t('Select the checks that the Security Review module makes on your site.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 217,
],
'#seo_guide' => [
'#title' => t('Security Review Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/security-review-module',
],
'#configure' => 'security_review',
],
'install_and_enable_honeypot_module' => [
'#title' => t('Install and Enable Honeypot module'),
'#description' => t('The Honeypot module provides an effective way to help eliminate spambot form submissions.'),
'#book_ref' => [
'#chapter' => 123,
'#page' => 123,
],
'#seo_guide' => [
'#title' => t('Honeypot Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/honeypot-module',
],
'#module' => 'honeypot',
'#seo_training_camp' => Url::fromUri('https://www.drupal.org/docs/contributed-modules/honeypot'),
],
'configure_honeypot_module' => [
'#title' => t('Configure Honeypot module'),
'#description' => t('Select the configuration options for the forms on your website.'),
'#book_ref' => [
'#chapter' => 123,
'#page' => 123,
],
'#seo_guide' => [
'#title' => t('Honeypot Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/honeypot-module',
],
'#configure' => 'honeypot.config',
],
'run_a_speed_test_for_your_site' => [
'#title' => t('Run a Speed Test for Your Site'),
'#description' => t("Before moving on, make sure to test your website's speed. These tools can provide benchmarks before moving forward to help you determine if more aggressive caching will improve your site's speed."),
'googles_page_speed_insights_tool' => [
'#text' => t("Google PageSpeed Insights"),
'#url' => Url::fromUri('https://developers.google.com/speed/pagespeed/insights/'),
],
'web_page_testorg' => [
'#text' => t('WebPageTest.org'),
'#url' => Url::fromUri('http://www.webpagetest.org/'),
],
],
'install_and_enable_advanced_css_js_aggregation_module' => [
'#title' => t('Install and Enable Advanced CSS/JS Aggregation module'),
'#description' => t('Makes your site run faster by aggregating and compressing CSS and Javascript files.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 233,
],
'#seo_guide' => [
'#title' => t('Advanced CSS/JS Aggregation Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/advanced-cssjs-aggregation-module',
],
'#module' => 'advagg',
],
'configure_advanced_cssjs_aggregation_module' => [
'#title' => t('Configure Advanced CSS/JS Aggregation module'),
'#description' => t('Set up how the Advanced CSS/JS Aggregation module works.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 235,
],
'#seo_guide' => [
'#title' => t('Advanced CSS/JS Aggregation Module'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/advanced-cssjs-aggregation-module',
],
'#configure' => 'advagg.settings',
],
'secure_your_website_with_https' => [
'#title' => t('Secure Your Website with HTTPS'),
'#description' => t('Google rewards secure websites with higher rankings.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 227,
],
'#seo_guide' => [
'#title' => t('Secure Your Website With HTTPS'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/https-securing-your-site',
],
],
'adjust_performance_admin_settings' => [
'#title' => t('Adjust Performance Admin Settings'),
'#description' => t('Increase performance of your website with proper caching.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 230,
],
'#seo_guide' => [
'#title' => t('Adjust Performance Admin Settings'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/adjust-performance-admin-settings',
],
'#configure' => 'system.performance_settings',
],
'configure_image_styles' => [
'#title' => t('Configure Image Styles'),
'#description' => t('Use smaller, perfectly-sized images to decrease bandwidth usage and increase site speed.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 239,
],
'#seo_guide' => [
'#title' => t('Image Styles'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/image-styles',
],
'#configure' => 'entity.image_style.collection',
],
'set_up_a_cdn_cloudflare_etc' => [
'#title' => t('Set up a CDN (Cloudflare, etc.)'),
'#description' => t('CloudFlare is a free reverse proxy, firewall, and global content delivery network and can be implemented without installing any server software or hardware.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 247,
],
'#seo_guide' => [
'#title' => t('Third Party Speed Options'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/cdn-content-delivery-network',
],
'#module' => 'cloudflare',
'#seo_training_camp' => Url::fromUri('https://www.cloudflare.com/'),
],
'move_to_fast_hosting' => [
'#title' => t('Move to Fast Hosting'),
'#description' => t('Faster hosting increases website response times which increase search rankings.'),
'#book_ref' => [
'#chapter' => 9,
'#page' => 247,
],
'#seo_guide' => [
'#title' => t('Move to Faster Hosting'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/third-party-speed-options',
],
],
],
'mobile_and_social' => [
'#title' => t('Mobile and social'),
'#description' => t('A mobile-friendly website ranks better in many search engines including Google. Social will help you build links.'),
'make_sure_website_is_responsive' => [
'#title' => t('Make sure website is responsive.'),
'#description' => t('Google recommends responsive websites for non-desktop devices.'),
'#book_ref' => [
'#chapter' => 10,
'#page' => 252,
],
'#seo_guide' => [
'#title' => t('Check Site for Responsive Web Design'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/check-site-responseive-web-design',
],
],
'install_and_enable_amp_module_theme_and_php_library_using_composer' => [
'#title' => t('Install and Enable AMP Module, Theme, and PHP Library using Composer'),
'#description' => t('The AMP module is designed to convert Drupal pages into pages that comply with the AMP standard.'),
'#book_ref' => [
'#chapter' => 10,
'#page' => 257,
],
'#seo_guide' => [
'#title' => t('AMP Accelerated Mobile Pages'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/amp-module-theme-php-library-suite',
],
'#module' => 'amp',
'#seo_training_camp' => Url::fromUri('https://www.ampproject.org/'),
],
'configure_amp' => [
'#title' => t('Configure AMP'),
'#description' => t('Configure the AMP module to show AMP pages when requested.'),
'#book_ref' => [
'#chapter' => 10,
'#page' => 259,
],
'#seo_guide' => [
'#title' => t('AMP Accelerated Mobile Pages'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/amp-module-theme-php-library-suite',
],
'#configure' => 'amp.settings',
],
'install_and_enable_share_buttons_by_addtoany' => [
'#title' => t('Install and Enable Share Buttons by AddToAny'),
'#description' => t('Adds SVG sharing icons for Drupal including a universal share button, Facebook, Twitter, Google+, Pinterest, WhatsApp, and many more.'),
'#book_ref' => [
'#chapter' => 10,
'#page' => 266,
],
'#seo_guide' => [
'#title' => t('Add To Any'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/add-to-any-module',
],
'#module' => 'addtoany',
'#seo_training_camp' => Url::fromUri('https://www.addtoany.com/'),
],
'configure_share_buttons_by_addtoany' => [
'#title' => t('Configure Share Buttons by AddToAny'),
'#description' => t('Set up how sharing buttons show up on your site.'),
'#book_ref' => [
'#chapter' => 10,
'#page' => 267,
],
'#seo_guide' => [
'#title' => t('Add To Any'),
'#url' => 'https://www.volacci.com/drupal-seo-guide/add-to-any-module',
],
'#configure' => 'addtoany.admin_settings',
],
],
'learning_giving_back' => [
'#title' => t('Learning and giving back'),
'#description' => t('Learn more about Drupal 8 SEO, give back by saying thanks, or report a bug or suggest a new feature.'),
'read_drupal_8_seo_by_ben_finklea' => [
'#title' => t('[Optional] Read <a href=":url">Drupal 8 SEO</a> by Ben Finklea', [
':url' => 'https://www.drupal8seo.com/',
]),
'#description' => t('This module was built together with the book Drupal 8 SEO. The book contains even more helpful tips along with step-by-step how-tos to get your site optimized for Google.'),
],
'use_and_link_to_our_online_drupal_seo_guide' => [
'#title' => t('[Optional] Use and link to our online <a href=":url">Drupal SEO Guide</a>', [
':url' => 'https://www.volacci.com/drupal-seo-guide',
]),
'#description' => t('We have updated the content from the Drupal 8 SEO book and published it on our website. Like the book, it contains even more helpful tips along with step-by-step how-tos to get your site optimized for Google.'),
],
'sign_up_for_a_drupal_org_account_if_you_dont_already_have_one' => [
'#title' => t('[Optional] Sign up for a <a href=":url">Drupal.org account</a> if you don\'t already have one', [
':url' => 'https://register.drupal.org/user/register',
]),
'#description' => t('Get involved in the Drupal community and help us make Drupal an even better Content Management System.'),
],
'if_the_seo_checklist_module_helped_you_please_help_get_the_word_out' => [
'#title' => t('[Optional] If the SEO Checklist module helped you, please help get the word out!'),
'#description' => t('Let\'s tell the world that Drupal is excellent for SEO! Please link to <a href=":url">the module page</a>.', [
':url' => 'https://www.drupal.org/project/seo_checklist',
]),
'tweet' => [
'#text' => 'Tweet',
'#url' => Url::fromUri('http://ctt.ec/IR0k4'),
],
'post_to_facebook' => [
'#text' => 'Post to Facebook',
'#url' => Url::fromUri('http://www.facebook.com/share.php?u=https://www.drupal.org/project/seo_checklist'),
],
],
'report_a_bug_or_recommend_changes_to_the_seo_checklist_module' => [
'#title' => t('[Optional] Report a bug or recommend changes to the SEO Checklist module.'),
'#description' => t('Submit a ticket on Drupal.org if you encounter a bug or want to suggest changes to the checklist.'),
'issue_queue' => [
'#text' => t('Issue queue'),
'#url' => Url::fromUri('https://www.drupal.org/project/issues/search/seo_checklist?status[]=Open'),
],
],
],
];
return _seo_checklist_preprocess_checklist_items($items);
}
function _seo_checklist_preprocess_checklist_items(array $items) : array {
$module_handler = \Drupal::moduleHandler();
$module_directories = $module_handler
->getModuleDirectories();
$access_manager = \Drupal::accessManager();
$current_user = \Drupal::currentUser();
$route_provider = \Drupal::service('router.route_provider');
foreach ($items as &$group) {
if (is_array($group)) {
foreach ($group as &$item) {
if (is_array($item)) {
$book_ref = isset($item['#book_ref']);
$book_chapter = $item['#book_ref']['#chapter'] ?? FALSE;
$book_page = $item['#book_ref']['#page'] ?? FALSE;
unset($item['#book_ref']);
$guide_ref = isset($item['#seo_guide']);
$guide_title = $item['#seo_guide']['#title'] ?? FALSE;
$guide_url = $item['#seo_guide']['#url'] ?? FALSE;
unset($item['#seo_guide']);
$args = [
'@book_chapter' => $book_chapter,
'@book_page' => $book_page,
':book_url' => 'https://www.drupal8seo.com/',
'@guide_title' => $guide_title,
':guide_url' => $guide_url,
];
$see_also = FALSE;
if ($book_ref && $guide_ref) {
if ($book_page) {
$see_also = t('<em>See <a href=":book_url">Drupal 8 SEO</a>, ch. @book_chapter, p. @book_page</em>, or the <em><a href=":guide_url">Drupal SEO Guide: @guide_title</a></em>.', $args);
}
else {
$see_also = t('<em>See <a href=":book_url">Drupal 8 SEO</a>, ch. @book_chapter</em>, or the <em><a href=":guide_url">Drupal SEO Guide: @guide_title</a></em>.', $args);
}
}
elseif ($book_ref) {
if ($book_page) {
$see_also = t('<em>See <a href=":book_url">Drupal 8 SEO</a>, ch. @book_chapter, p. @book_page</em>.', $args);
}
else {
$see_also = t('<em>See <a href=":book_url">Drupal 8 SEO</a>, ch. @book_chapter</em>.', $args);
}
}
elseif ($guide_ref) {
$see_also = t('<em>See the <a href=":guide_url">Drupal SEO Guide: @guide_title</a></em>.', $args);
}
$description = isset($item['#description']) ? "{$item['#description']} " : '';
if ($see_also) {
$item['#description'] = $description . $see_also;
}
if (isset($item['#module'])) {
$module_name = $item['#module'];
$module_url_fragment_safe_name = str_replace('_', '-', $module_name);
$enabled = $module_handler
->moduleExists($module_name);
$item['#default_value'] = $enabled;
$item['#description'] .= '</p><p class="cli-commands">' . "Composer: <code>composer require drupal/{$module_name}</code><br />" . "Drush: <code>drush dl {$module_name} && drush en {$module_name}</code>";
$item['project_page'] = [
'#text' => t('Download'),
'#url' => Url::fromUri("https://www.drupal.org/project/{$module_name}"),
];
if ($access_manager
->checkNamedRoute('system.modules_list', [], $current_user)) {
$item['modules_page'] = [
'#text' => t('Install'),
'#url' => Url::fromRoute('system.modules_list', [], [
'fragment' => "module-{$module_url_fragment_safe_name}",
]),
];
}
if ($enabled && $access_manager
->checkNamedRoute('user.admin_permissions', [], $current_user)) {
$has_permissions = file_exists("{$module_directories[$module_name]}/{$module_name}.permissions.yml");
if ($has_permissions) {
$item['permissions_page'] = [
'#text' => t('Configure permissions'),
'#url' => Url::fromRoute('user.admin_permissions', [], [
'fragment' => "module-{$module_name}",
]),
];
}
}
unset($item['#module']);
}
if (isset($item['#seo_training_camp'])) {
$item['seo_training_camp'] = [
'#text' => t('SEO training camp'),
'#url' => $item['#seo_training_camp'],
];
unset($item['#seo_training_camp']);
}
if (isset($item['#configure'])) {
$route_name = $item['#configure'];
try {
$route_exists = (bool) $route_provider
->getRouteByName($route_name);
} catch (RouteNotFoundException $e) {
$route_exists = FALSE;
}
if ($route_exists && $access_manager
->checkNamedRoute($route_name, [], $current_user)) {
$item['configure'] = [
'#text' => t('Configure'),
'#url' => Url::fromRoute($route_name),
];
}
unset($item['#configure']);
}
}
}
}
}
return $items;
}
function seo_checklist_form_checklistapi_checklist_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$checklist = $form['#checklist'];
if ($checklist->id === 'seo_checklist') {
$form['#attached']['library'][] = 'seo_checklist/seo_checklist';
$form['be_efficient']['install_and_enable_seo_checklist_module']['#default_value'] = TRUE;
$get_the_word_out_links =& $form['learning_giving_back']['if_the_seo_checklist_module_helped_you_please_help_get_the_word_out']['#description'];
$get_the_word_out_links = str_replace('</div>', ' | ' . t('Blog about it') . '</div>', $get_the_word_out_links);
}
}
function seo_checklist_theme($existing, $type, $theme, $path) : array {
return [
'seo_checklist_getting_started' => [
'variables' => [
'ga_query_string' => SEO_CHECKLIST_GA_QUERY_STRING,
],
],
];
}