See the blog on installing Drupal modules if you need to install these.
You will need to install the dependencies listed below to enable some of the recommended SEO modules. Drupal will notify you when you enable a module or if using Composer it will notify you at the time on running require. If the module is not present in the modules directory you won't be able to select to install and it will tell you in the UI with a missing highlight. For more information on both modules, you can check the Drupal website.
Needed for Pathauto & Metatag.
Needed for Pathauto.
I only recommend needing 3 modules to get going. I have a few others you may like to look at in time or if you are wanting to improve the SEO of an existing Drupal 9 (8 or 7) site with lots of content. I will write a follow up on these in a few weeks once I implement them on this particular site. Below are the 3 modules all sites need if they are to implement modern SEO practices.
Your first piece of content created will be node/1, second node/2, and so on. Pathauto makes pretty URLs for you, that is when you save your content it will generate a more friendly URL. In the case of this page, the URL is /drupal-seo-modules. Pathauto needs to be configured once installed, but to get going you only need to generate a pattern for your content pages. To do this go to the URL Aliases page in the Search and metadata section of Configuration and find the Patterns tab, click + Add Pathauto pattern. I suggest using the content title by entering the [node:title] token, you can browse all tokens from the token modal window by clicking Browse available tokens under the input. After making the pattern you can bulk update all previously published content, for full detail check below. Pathauto does much more so have a look at the setting page.
Actively maintained Yes
Requires Token & CTools
- Set up a pattern at /admin/config/search/path/patterns . Patterns use tokens and hard codes paths. i.e [node:title] or /blog/[node:title]
- If you already have content then you need to go to /admin/config/search/path/update_bulk and follow the instructions. You can also update from the node(content) edit form or use an Action on the Content overview page.
Remember also if you have redirect installed (next project module) it will create redirects for all new URLs, quite powerful stuff.
The main reason we need this module is to Enforce clean and canonical URLs, what I mean here is even though Pathauto makes a nice clean URL you can still visit the page at its node/# URL, Redirect will automatically redirect to the clean URL so no chance of duplicate page indexing by search engines. It is also used to redirect when we rename pages and keep a record of it. A note on this, if you change the name of your page URL alias multiple times before publishing, you might as well delete the redirects as they will never be needed.
Actively maintained Yes
Requires no contributed project module, just a few core modules, i.e no extra to install.
Enable Redirect module and you are good to go, it's that easy. Do check out the settings page and also the redirects page to see what options it has.
- Doesn't work when the site is offline.
- Has a couple of sub-modules you may find useful, check the Extend page.
- Allows you to set the type of redirect, 301 permanent is the default and probably most used.
(note to self, doesn't give you access count as D7 does).
Metatag takes care of the majority of your onsite and technical SEO by adding metadata to the head of the documents so search engines can more easily index your content. Metadata doesn't generally boost your rankings but informs search engines of how you see your content. Metadata is not the be-all and end-all of SEO, but that is another story. I recommend downloading and enabling the Metatag module so that you have the tools at hand from day 1.
Actively maintained Yes
Doesn't work when a site is off-line
Has a multiple sub-modules
Out of the box it works, it adds canonical URL and title to all pages and adds description to content pages, this module is so configurable and gives you everything you need for modern SEO through a plethora of modules from FB to Dublin Core... just look on the extend page and enable what you need.
- You will need to set up a description for your frontpage, and decide on how you want to set up you descriptions (see next point) to start but that's about it.
- Descriptions by default show either the body content with no character limit or if you add a summary it will show that. Body isn't ideal as it sets no limit, but a summary works. You can add a field specific for this use and then use a token to use that field, currently the default token is [ node:summary] but you could add a field and then use the new field's token [node:field_my_new_field], it's that easy. I will write about this too in the coming weeks.
Other Modules that you could need
I will write up about these in the weeks to come, on this site I am using Matomo Analytics so I won't need Google Analytics module. I have used it on other sites, Drupal 7 and 8 sites, and at it most basic it allows you to add your Google Analytics account number.
If you use Google Analytic you can see the project module here https://www.drupal.org/project/google_analytics
Other modules that are also helpful are either Sitemap or sitemap XML. They make a nice XML sitemap at yourdomain/sitemap.xml
I have written about XML Sitemap module here or you can more details of either on Drupal website by following the links below.
SEO Checklist looks interesting, it helps you with the SEO process by suggesting things and project modules to use. I have never used this but it could be useful, lets see as I work on some older sites.
Thanks for reading and be sure to follow on Twitter.