If you’re constructing a website, it is commonplace to arrange “fairly URLs”. For instance, we might moderately see /catalog/equipment than /taxonomy/time period/18 and we might moderately see /about-us than /node/19. With , we use Drupal Development Service Pathauto Drupal 10 module to configure some of these commonplace content material paths. However in some instances, there isn’t any choice to create a pleasant URL sample, so we find yourself seeing these URLs. This occurs with Views which are filtered by a taxonomy time period in Drupal Development Service URL. Drupal Development Service result’s that you find yourself seeing taxonomy time period IDs in Drupal Development Service URL (e.g. catalog/19/search) moderately than a reasonably URL (e.g. catalog/equipment/search). On this tutorial, I am going to stroll you thru learn how to create a area that’s used to make generate URLs for Views pages that take taxonomy phrases as contextual arguments. Utilizing this method, a website editor will be capable to configure what Drupal Development Service URL path will seem like. Assumptions It has been assumed that you recognize Drupal 10 Upkeep and Assist Service Drupal Development Service fundamental ideas of 8. configure fields. configure a view with a contextual filter. create a customized Drupal 10 module in 8. create a customized plugin in 8. Drupal Development Service answer We will use Drupal Development Service core taxonomy argument plugin (taxonomyPluginviewsargumentTaxonomy) to assist us repair this drawback. Drupal Development Service plugin takes a time period ID from Drupal Development Service URL and passes it to Views. We’ll override Drupal Development Service plugin in order that it takes a string from Drupal Development Service URL (slug), after which seems up Drupal Development Service related time period ID. All Drupal Development Service remainder of Drupal Development Service performance we’ll go away as is. Step 1 Drupal 10 Upkeep and Assist Service Content material and area configuration To make Drupal Development Service instance work, we want Drupal Development Service following configuration to be in place (most of this you get out-of-the-box with , you may simply want so as to add Drupal Development Service Slug area) Drupal 10 Upkeep and Assist Service A taxonomy vocabulary named tags. Tags ought to have Drupal Development Service following area Drupal 10 Upkeep and Assist Service Area title Drupal 10 Upkeep and Assist Service Slug Machine title Drupal 10 Upkeep and Assist Service field_slug Kind Drupal 10 Upkeep and Assist Service Textual content (Plain) Measurement Drupal 10 Upkeep and Assist Service 32 characters A content material kind named article. Article ought to have Drupal Development Service following area Drupal 10 Upkeep and Assist Service Area title Drupal 10 Upkeep and Assist Service Tags Machine title Drupal 10 Upkeep and Assist Service field_tags Kind Drupal 10 Upkeep and Assist Service Entity reference (to taxonomy phrases from Tags) Variety of values Drupal 10 Upkeep and Assist Service At the least one Configuring area slug on taxonomy time period Step 2 Drupal 10 Upkeep and Assist Service Create a customized Drupal 10 module Create a customized Drupal 10 module known as custom_views_argument. Declare a dependency on Drupal Development Service views Drupal 10 module in Drupal Development Service .information.yml file. Step 3 Drupal 10 Upkeep and Assist Service Implement hook_views_data_alter() Reference Drupal 10 Upkeep and Assist Service custom_views_argument.Drupal 10 module Drupal Development Service hook_views_data_alter() hook tells Views about Drupal Development Service varied database tables, fields and Drupal Development Service related plugins related to them. We implement this hook to inform to incorporate our customized argument plugin which we are going to create in Drupal Development Service subsequent step. Step 4 Drupal 10 Upkeep and Assist Service Create a customized views argument plugin Reference Drupal 10 Upkeep and Assist Service CustomTaxonomySlug.php Subsequent we implement Drupal Development Service CustomTaxonomySlug class with a correct annotation @ViewsArgument(“custom_taxonomy_slug”). This tells Drupal Development Service Views Drupal 10 module that Drupal Development Service class is a particular class which implements a customized Views argument plugin. We prolong Drupal Development Service taxonomyPluginviewsargumentTaxonomy class and override one essential methodology CustomTaxonomySlug Drupal 10 Upkeep and Assist Service Drupal 10 Upkeep and Assist ServicesetArgument(). public operate setArgument($arg) { // If we aren’t coping with Drupal Development Service exception argument, instance “all”. if ($this->isException($arg)) { return guardian Drupal 10 Upkeep and Assist Service Drupal 10 Upkeep and Assist ServicesetArgument($arg); } // Convert slug to taxonomy time period ID. $tid = is_numeric($arg) ? $arg Drupal 10 Upkeep and Assist Service $this->convertSlugToTid($arg); $this->argument = (int) $tid; return $this->validateArgument($tid); }All we do right here is catch Drupal Development Service argument from Drupal Development Service URL and if it’s a slug, we use a convertSlugToTid() methodology to retrieve Drupal Development Service underlying taxonomy time period ID. That’s it! Drupal Development Service remainder of Drupal Development Service issues are dealt with by Drupal Development Service taxonomy plugin. Step 5 Drupal 10 Upkeep and Assist Service Create Demo Content material Now that the whole lot is in place, we’ll put our answer to Drupal Development Service check. Begin by creating some demo content material. Create 2-3 articles and assign them some tags. Drupal Development Service tags are created, nevertheless, they do not have a slug. As soon as carried out, go to Drupal Development Service Admin > Construction > Taxonomy > Tags web page and edit Drupal Development Service tags and provides them good URL slugs containing solely English alphabet letters, numbers and dashes. For actual tasks, you would possibly want to make use of a customized or contrib Drupal 10 module to mechanically generate slugs (see Drupal Development Service machine_name Drupal 10 module). Step 6 Drupal 10 Upkeep and Assist Service Configure a View Now we’re all set! Drupal Development Service final step is to create and configure a View which is able to put the whole lot collectively. Create a View of Content material. You possibly can title it Weblog. Create a web page show and set it is URL to /weblog/%. Add a relationship to taxonomy phrases referenced from field_tags. We do that to have the ability to use Drupal Development Service Slug area in a filter. Configure a relationship with taxonomy phrases Now, outline a contextual filter for Drupal Development Service Slug utilizing Drupal Development Service customized argument plugin which we created. Click on on Drupal Development Service Add button for Contextual filters Select Drupal Development Service Slug filter which we created. It ought to have Drupal Development Service title we had outlined in our plugin, i.e. Customized Drupal 10 Upkeep and Assist Service Has taxonomy time period with slug. Optionally, specify a validation standards for Taxonomy Time period and specify Drupal Development Service Tags vocabulary. Configuring Drupal Development Service customized views argument plugin for contextual filters Save Drupal Development Service view for Drupal Development Service new configuration to take impact. And we’re carried out! In case you go to Drupal Development Service /weblog/SLUG, it’s best to see all Drupal Development Service articles which have Drupal Development Service taxonomy time period related to SLUG. Right here, SLUG refers to Drupal Development Service worth you set in Drupal Development Service Slug area for Drupal Development Service tag. E.g. you probably have a tag named Equipment and also you wrote equipment in Drupal Development Service Slug area, it’s best to go Drupal Development Service Drupal Development Service URL /weblog/equipment. Subsequent steps See Drupal Development Service code for Drupal Development Service customized views argument plugin on GitHub. Learn extra about hook_views_data() and hook_views_data_alter(). Learn extra about Drupal Development Service Plugin API in 8. In case you’re searching for hands-on coaching about learn how to develop Drupal 10 modules, we provide skilled coaching on-line and in-person. See Drupal Development Service full 8 Drupal 10 Assist Growth coaching curriculum for particulars. + extra superior articles by Evolving Net Drupal 10 Growth and Assist
Evolving Net Drupal 10 Upkeep and Assist Service Create a Customized Views Argument Plugin in 8

Call Us: 1(800)730-2416
Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit
Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)
Evolving Net Drupal 10 Upkeep and Assist Service Create a Customized Views Argument Plugin in 8
On-Site Drupal SEO Master Setup
We make sure your site is 100% optimized (and stays that way) for the best SEO results.
With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.
This service includes:
- Pathauto install and configuration for SEO-friendly URLs.
- Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
- Install and fix all issues on the SEO checklist module.
- Install and configure XML sitemap module and submit sitemaps.
- Install and configure Google Analytics Module.
- Install and configure Yoast.
- Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
- Install and configure Schema.org Metatag.
- Configure robots.txt.
- Google Search Console setup snd configuration.
- Find & Fix H1 tags.
- Find and fix duplicate/missing meta descriptions.
- Find and fix duplicate title tags.
- Improve title, meta tags, and site descriptions.
- Optimize images for better search engine optimization. Automate where possible.
- Find and fix the missing alt and title tag for all images. Automate where possible.
- The project takes 1 week to complete.
