Golems GABB: Best SEO Practices for Drupal Websites in 2024
If you are enthusiastic about Best SEO Practices for Drupal Websites in 2024 and want to grow your website traffic, you are just in the right place! Drupal is like a wise friend on the web who helps you complete tasks quickly without understanding many programming details. Also, it has some cool tricks that make your website both Google-friendly and user-friendly. And here we go, deeper into optimizing your SEO for Drupal!
Drupal SEO Checklist in 2024
All right, let's make a rough Drupal SEO checklist.
DrupalEasy: Getting ready to run your first migration
Migrating content into Drupal is an extremely useful skill for most Drupal developers. Often, the most difficult step in learning to do migrations is the first one - that of getting everything set up and running your first migration to ensure that everything is working as expected.
Most Drupal migration-related blog posts and documentation that I've seen either completely ignore the setup process or gloss over it before diving into the details of writing migrations. I like to ensure, both here, and when working with participants in our Professional Module Development course, that we ensure a solid understanding of this process to build not only skills, but confidence.
This blog post will explain how to set up and run your first (very simple) Drupal migration. The process I will outline is actually the same steps I do when beginning to write a custom migration - just to make sure I have everything "hooked up" properly before I start getting into the more complex aspects of the project.
I generally write migrations on my local machine, using DDEV as the local development environment.
Configuration migrations vs. Plugin migrations
When creating a custom migration, one of the initial decisions to be made is whether you'll write the migrations as plugins or configuration entities. I've always used configuration entities, but there are pros and cons to both approaches. Here, we will focus on configuration entity migrations.
There are some minor differences in the workflow presented below when using plugin migrations. For more information on the differences, I recommend Mauricio Dinarte's article.
Core and contrib modules used
If you're planning on following along with this article, the following modules should be installed and enabled:
Drupal core:
- Migrate
- Migrate Drupal
Contrib:
- Migrate tools (for Drush commands) https://www.drupal.org/project/migrate_tools
- Migrate plus (migrations as configuration, additional process plugins, and more) https://www.drupal.org/project/migrate_plus
Source database
This blog post will demonstrate importing a small portion of user data from a Drupal 7 site into a Drupal 10 site. Normally, the first step is setting up the source data: in this case a Drupal 7 database. I normally create a new d7 database on the same MariaDB server as the Drupal 10 site (using DDEV, this is quite easy) and then import the Drupal 7 database into it.
Next, we have to tell the Drupal 10 site about the d7 source database. This can be done by adding the following database connection array to the bottom of your settings.local.php file (which I know you're using!):
$databases['migrate']['default'] = array(
'driver' => 'mysql',
'database' => 'd7',
'username' => 'db',
'password' => 'db',
'host' => 'db',
'port' => 3306,
'prefix' => '',
);
Note the database key is migrate and the database name is d7. Everything else is identical to the regular Drupal 10 database credentials in DDEV. If you're using Lando or another local development environment, then your database connection array may be different.
Custom migration module
Next, we need a custom module to house our migration. The easiest way to create one is via Drush's generate command:
$ drush generate module
Welcome to module generator!
––––––––––––––––––––––––––––––
Module name:
➤ My d7 migration
Module machine name [my_d7_migration]:
➤
Module description:
➤ Migrations from Drupal 7 site.
Package [Custom]:
➤
Dependencies (comma separated):
➤ migrate, migrate_drupal, migrate_plus
Would you like to create module file? [No]:
➤
Would you like to create install file? [No]:
➤
Would you like to create README.md file? [No]:
➤
The following directories and files have been created or updated:
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
• /var/www/html/web/modules/custom/my_d7_migration/my_d7_migration.info.yml
Once created, go ahead and enable the module as well:
$ drush en my_d7_migration
Migration group configuration
As this blog post will be writing migrations as configuration entities, create a new config/install directory in your new module.
We'll define a migration group to which all of our migrations will belong - this is what connects each migration to the source d7 database. Create a new migrate_plus.migration_group.my_group.yml file in the new config/install directory with the following contents:
id: my_d7_migration
label: My Drupal 7 migration.
description: Content from Drupal 7 site.
source_type: Source Drupal 7 site
shared_configuration:
source:
key: migrate
migration_tags:
- Drupal 7
- my_d7_migration
The most important bit of this configuration is the source key of migrate; this links up this migration group with the d7 database, with the migrate key we previously configured. Then, any migration created that is in this group automatically has access to the source d7 database.
Simple sample migration configuration
Next, let's look at a super simple example migration for user entities. This will not be a complete user migration, but rather just enough to migrate something. Many migration blog posts, documentation pages and other sources provide guidance and examples for writing migration configuration files (remember, this blog post is focused on all of the configuration and mechanics that normally aren't covered in other places.)
Here's the user migration configuration we'll use. Create a new /config/install/migrate_plus.migration.user.yml file in your custom module with the following contents:
id: user
label: Migrate D7 users.
migration_group: my_d7_migration
source:
plugin: d7_user
process:
name: name
pass: pass
mail: mail
created: created
access: access
login: login
status: status
timezone: timezone
destination:
plugin: entity:user
Reputable Drupal migration articles and documentation will explain that migrations need a source (extraction,) some processing (transform,) and a destination (where to load the data.) Often these three concepts will be called ETL. Each of these concepts are easy to spot in our sample configuration file:
- The data is coming from the d7_user plugin (provided by Drupal core with the data source being that of the my_d7_migration group which we configured in a previous step.)
- The processing of the data in this simple migration is just field mapping (to: from.) Many migration configurations have transformations as part of this section, often provided by Drupal process plugins.
- The destination is Drupal user entities.
Running the migration
Again, these instructions are specific to Drupal migration configurations when created as configuration entities. Instructions for migration configuration written as plugins are slightly different (and not covered in this article.)
As we are dealing with configuration entities, they must be imported into the active configuration store - which, by default, is the Drupal database. This is easily accomplished with the drush cim --partial command. This must be run each and every time a migration configuration file is modified. This is one of the (few, in my opinion) downsides of writing migrations as configurations.
Next, I often check the status of migration via the drush migrate:status command. When using the Migrate Drupal module, it is recommended to always use the --group option otherwise the output of migrate:status can get a bit messy (due to all the default migrations that will be displayed.)
The drush migrate:import and migrate:rollback commands should be self-explanatory. Each can be used with either the --group option or with a migration name (as shown below.) I almost always use the --update option on migrate:import for updating previously imported data.
Finally, keep the drush migrate:reset command in your back pocket when writing custom migrations. If the migration crashes, you'll need to use this to reset its status from processing to idle in order to run it again.
Here's a full set of the command specific to the sample user migration, migration group, and custom module created in this article:
$ drush cim --partial --source=modules/custom/my_d7_migration/config/install
$ drush migrate:status --group=whatever
$ drush migrate:import user --update
$ drush migrate:reset user
$ drush migrate:rollback user
What's next?
What I've presented in this article is 90% of what I regularly use when running migrations. Sure, there are a few edge cases where oddities occur, but I believe this is a solid base of knowledge to start with.
Once all this makes sense, I encourage you to utilize other blog posts and documentation to extend the user migration we started, or write new ones based on other resources. Once you're comfortable writing additional migrations, learning how to create your own process plugins is the natural next step. As process plugins are written as PHP classes, some knowledge of module development is necessary.
Interested in learning more about Drupal module development? Check out DrupalEasy's 15-week Professional Module Development course!
Additional resources
- UnderstandDrupal.com - loads of resources about Drupal migrations from Mauricio Dinarte.
- Tag1's recent series about migrations (also written by Mauricio Dinarte!):
- Migration related modules (definitely not an exhaustive list, but a solid start):
- Migrate plus
- Migrate tools
- Migrate devel
- Migrate process extra - process plugins for migrations.
- Migrate conditions - additional process plugins for migrations.
- Migrate source CSV - allows migrations from .csv files.
- Migration tools - even more process plugins and additional helper classes and methods for migration.
- Migrate upgrade - Drush support for the Drupal core migrations from Drupal 6 and 7.
Lead image generated by OpenAI.
Wim Leers: XB week 8: design locomotive gathering steam
Last week was very quiet, July 1–7’s #experience-builder
Drupal Slack meeting was even more tumbleweed-y…
… but while that was very quiet, the Acquia UX team’s design locomotive was getting started in the background, with two designs ready-to-be-implemented posted by Lauri — he’s working with that team to get his Experience Builder (XB) product vision visualized:
- #3458503: Improve the page hierarchy display — with Gaurav “Gauravvvv” enthusiastically jumping on it!
- #3458863: Add initial implementation of top bar
On top of that, a set of placeholder issues was posted — choices to be made that need user research before an informed design can be crafted:
- #3459088: Define built-in components and categorization for components
- #3459229: Allow saving component compositions as sections
- #3459234: Allow directly creating/editing entity title and meta fields
- #3459098: Define strategy for keyboard shortcuts
- #3459236: Redirect users directly to Experience Builder when creating new content or editing content
More to come on the design front! :)
Missed a prior week? See all posts tagged Experience Builder.
Goal: make it possible to follow high-level progress by reading ~5 minutes/week. I hope this empowers more people to contribute when their unique skills can best be put to use!
For more detail, join the #experience-builder
Slack channel. Check out the pinned items at the top!
Speaking of design, Hemant “guptahemant” Gupta and Kristen “kristenpol” Pol are volunteering on behalf of their respective employers to implement the initial design system prior to DrupalCon Barcelona.
Front end
- Jesse “jessebaker” Baker landed an important refactor (#3456946: Refactor Preview.tsx React component to prevent duplicate backend calls), with reviews from Ben “bnjmnm” Mullins and Lee “larowlan” Rowlands
- Jesse also landed a small foundational piece of the UI: #3458723: Implement context menu for hovered component, which also is a crucial stepping stone for future accessibility work
- Harumi “hooroomoo” Jang got #3456084: Add initial implementation of primary menu landed and filed the follow-up #3458617: Close menu on drag in primary menu — which subsequently spawned an interesting discussion about the design between Jesse and Lauri
- Jesse got #3459235: Implement front-end (React) routing library going, with enthusiastic participation from Bálint “balintbrews” Kléri and Ronald “roaguicr” Aguilar
- Having observed environment setup issues for some, Ben opened #3458369: DDEV support for Cypress tests after witnessing how painful it was for Jesse to get Cypress talking to Drupal inside DDEV
Front-end starting points for contributing to XB
Jesse reported two bugs that would be excellent starting points for contributing to XB:
- #3459333: Undo/redo - user can undo the loading of the initial state (regression)
- #3458535: Middle click + drag doesn’t work correctly if middle click is inside preview iframe
And Lauri added a feature request that builds on top of the aforementioned foundational UI piece Jesse & Ben landed (#3459249: Allow opening the contextual menu by right clicking a component) — that too is a great entry point.
Back end
And, finally, on the back-end side:
- Ted “tedbow” Bowman pushed forward #3456008: Add support for matching SDC prop shape: {type: string, enum: …} but got stuck. He opened #3458580 as a blocker … and upon my return that Friday, I discovered that actually … that was working correctly, but the implementation was very confusing — not surprising, considering this code dated back to a PoC branch from the chaotic origins. So, instead, the logic was made a lot clearer, with better comments. If you’re interested in the deepest parts of how Drupal handles structured data, you’ll probably find it an intriguing commit. 1
- I’d missed it the previous week, but Lee actually did a huge push forward on #3454519: [META] Support component types other than SDC, by turning a high-level concept into a concrete proposal in the form a massive draft MR, with lots of interesting concepts, all rooted in his real-world experience with Layout Builder. An interesting discussion between Alex “effulgentsia” Bronstein and Lee ensued :)
Thanks to Lauri for reviewing this!
-
Sadly, it’s an inevitability that this is still complex: Drupal 8 introduced Typed Data API into the pre-existing Field API, and then later the Symfony validation constraint API was integrated into both. Getting a full picture of what constraints apply to an entire entity field data tree is not something Drupal core provides, so that picture must be manually crafted, which is what that code does. ↩︎
Specbee: Top 8 Drupal modules that can improve user engagement
Talking Drupal: Talking Drupal #460 - Preconfigured CMS Solutions
Today we are talking about Preconfigured CMS Solutions, How they can help your business, and The best way to build them in Drupal with guests Baddy Sonja Breidert and Dr. Christoph Breidert.
For show notes visit: www.talkingDrupal.com/460
Topics- Spain
- What is a Preconfigured CMS / Drupal Solution
- Who is the audience
- What business objectives can preconfigured solutions solve
- What are the ingredients
- How do you manage theming
- How do you manage customized design
- What do you do if your client has a need that your preconfigured solution does not solve
- What about Starshot
- Did the two of you meet over Drupal
- How do you manage work life balance
Christoph Breidert - 1xINTERNET breidert
HostsNic Laflin - nLighteneddevelopment.com nicxvan John Picozzi - epam.com johnpicozzi Baddý Sonja Breidert - 1xINTERNET baddysonja
MOTW CorrespondentMartin Anderson-Clutz - mandclu.com mandclu
- Brief description:
- Have you ever wanted to customize the way Google Maps appear on your Drupal site? There's a module for that.
- Module name/project name:
- Brief history
- How old: created in Mar 2014 by iampuma, but recent releases are by Artem Dmitriiev (a.dmitriiev) of 1xINTERNET
- Versions available: 7.x-2.0, 8.x-1.7, and 8.x-2.6 versions available, the last of which works with Drupal 8, 9, 10, and 11
- Maintainership
- Actively maintained, latest release a week ago
- Security coverage
- Has a Documentation page and lots of information on the project page
- Number of open issues: 8 open issues, 1 of which is a bug against the current branch, though it was actually fixed in the latest release
- Usage stats:
- 1,764 sites
- Module features and usage
- The module provides allows your Drupal to use custom styles, which you can copy and paste from SnazzyMaps.com, or create from scratch using a configuration widget on Github that is linked from the project page
- You will be able to use custom markers by using the System Stream Wrapper module
- You can also specify popups for the markers, using a field or a view mode
- If you use the companion styled_google_views module, you can also show multiple locations, and define clustering options
- Styled Google Map also has integration with Google's Directions service, so visitors can easily get turn-by-turn directions for how to reached their chosen location
- The module also includes a demo submodule you can use to quickly set up a working example to illustrate all the different options available using Styled Google Map
The Drop Times: Modernizing Your Web Presence with Drupal
Hello Tech Enthusiasts,
In this edition, we’re exploring why Drupal is a smart choice for your website development needs.
Drupal’s modular design makes it highly scalable and flexible, allowing it to support everything from small blogs to large enterprise sites. This adaptability ensures your website can grow and evolve alongside your business without needing extensive overhauls.
Managing content on Drupal is straightforward, thanks to its intuitive interface. Even non-technical users can easily handle updates and changes. Additionally, with numerous themes and modules, customization is virtually limitless, enabling businesses to tailor their sites to specific requirements.
Security is another area where Drupal excels. Regular updates and a robust security framework protect your site from vulnerabilities. Plus, being open-source, Drupal benefits from a vibrant community that continually contributes to its development, ensuring continuous improvements and access to a wealth of resources.
Businesses across various industries have successfully used Drupal to create dynamic, secure, and scalable websites. For example, the University of Oxford leverages Drupal to manage extensive content libraries and facilitate complex workflows efficiently. You can read more about their experience here.
Drupal offers a powerful and versatile CMS solution for modern website development. Its scalability, ease of use, extensive customization options, and strong security make it an ideal choice for businesses aiming to enhance their web presence. Supported by an active community, Drupal continues to meet the diverse needs of its users.
With that, now explore some of the highlighted stories we covered last week:
Join The DropTimes (TDT) for its milestone 100th interview with Dries Buytaert, the innovative founder of Drupal. Interviewed by Anoop John, Founder and Lead of The DropTimes, this conversation explores Drupal’s rich history and transformative journey.
Learn how to migrate new content efficiently using Drupal's Migrate API. Jaymie Strecker's second part of this tutorial, "Using Drupal Migrations to Modify Content Within a Site," provides detailed examples of creating paragraphs, nodes, URL aliases, and redirects.
The 2024 Drupal Association board election is now open. Community members can nominate themselves until 30 July 2024. Voting begins on 15 August.
The Drupal Association's annual survey is now open! Digital service providers worldwide are invited to share their insights on market trends, growth opportunities, and more. Participate by September 4 to contribute to the comprehensive report and see the results presented at the CEO Dinner during DrupalCon Barcelona.
Varbase 10.0.0 has arrived, bringing a host of enhancements and new features to this comprehensive Drupal distribution. Built on Drupal 10, it offers improved performance, PHP 8.1 compatibility, and a modern CKEditor 5 integration.
Drupal Starshot is recruiting track leads to drive crucial project tracks, focusing on areas like Drupal Recipes, installer enhancements, and product marketing. Apply by July 31st to contribute to this innovative initiative and help shape the future of Drupal.
Mark Conroy introduces the LocalGov KeyNav module, enabling keyboard shortcuts for navigating LocalGov Drupal websites. This module, sponsored by Big Blue Door, enhances site usability with customizable key sequences for quick access to various pages.
DrupalCon Barcelona 2024 invites registered attendees to submit proposals for Birds of a Feather (BoF) sessions. BoFs provide an inclusive, informal environment to discuss Drupal, technology topics, or personal interests. Submit your BoF proposal by September 25, 2024, to join the conversation.
Gábor Hojtsy and Lauri Timmanee have released the open-source slide deck and video recording from their keynote on Drupal Starshot at Drupal Developer Days 2024. Access these resources for your events and presentations.
Sponsorship opportunities are now available for DrupalCamp Pune 2024, which will take place on October 19-20. This is a great opportunity to engage with the global Drupal community and showcase your brand.
Submit your session proposals for Twin Cities Drupal Camp 2024 by August 15. The camp, scheduled for September 12-13, 2024, welcomes diverse topics related to Drupal and web development.
We acknowledge that there are more stories to share. However, due to selection constraints, we must pause further exploration for now.
To get timely updates, follow us on LinkedIn, Twitter and Facebook. Also, join us on Drupal Slack at #thedroptimes.
Thank you,
Sincerely
Kazima Abbas
Sub-editor, The DropTimes.
The Drop Times: Why Should Agencies Respond to Drupal Business Survey?
the floating-point divide: Using Drupal migrations to deploy new content
Following up on my previous article about using Drupal migrations to modify content, this article looks at importing new content into a site. I give examples of migrations that create paragraphs, nodes, URL aliases, and URL redirects.
mark.ie: My Drupal Core Contributions for week-ending July 19th, 2024
Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.