Continuing from our previous post, 8 DIY Drupal 10 Maintenance and Support Service Creating a Slideshow with Theme Libraries and Slick, we wanted to build on the power of theme libraries provide us in 8. While continuing to showcase examples from Scanse.io, we wanted to share another functionality we implemented with theme libraries — Content tabs. 7 has a popular Drupal 10 module called, Quicktabs that does this well. However, this Drupal 10 module was not ready for 8 and, even if it was, its reliance on blocks didn’t really fit with our Paragraphs implementation. So, another reason to DIY in the theme layer. Creating your own content tabs To achieve this functionality, we decided to lean on theme libraries and slick again. But wait… slick is for slideshows right? Yes, it is. But when you think about it, how different are content tabs? Instead of a dot pager along the bottom, we have a title pager along the top. Instead of sliding right to left, we fade in and out. We decided it would work quite well in this case. The HTML Markup As expected our markup is very similar when compared to the slideshow markup presented in 8 DIY Drupal 10 Maintenance and Support Service Creating a Slideshow with Theme Libraries and Slick. The content being rendered within .tabs__tab-item is more complex in this use case. However, this content is styled as a completely decoupled component. In an effort to make the tabs component reusable, we set this up so the tabs display does not care what is actually rendered within the tab itself. LiDAR for every application Robotic & UAVs … … … Create a Theme Library Here we continue to use the same slick theme library that we started for our slideshow. To make this work, we add the following new code for .js-slick-single-item-tabs in slick.config.js. slick.config.js (function ($, , window, document) { .behaviors.THEMESlickConfig = { attach Drupal 10 Maintenance and Support Service function (context, settings) { $(“.js-slick-single-item-center”).slick({ … }); $(“.js-slick-single-item-tabs”).slick({ dots Drupal 10 Maintenance and Support Service true, infinite Drupal 10 Maintenance and Support Service true, speed Drupal 10 Maintenance and Support Service 500, fade Drupal 10 Maintenance and Support Service true, adaptiveHeight Drupal 10 Maintenance and Support Service true, customPaging Drupal 10 Maintenance and Support Service function(slider, i) { var title = $(slider.$slides[i]).find(‘.article__title’).text(); return ‘<a>’ + title + ‘</a>’; }, responsive Drupal 10 Maintenance and Support Service [ { breakpoint Drupal 10 Maintenance and Support Service 720, settings Drupal 10 Maintenance and Support Service { customPaging Drupal 10 Maintenance and Support Service function(slider, i) { return ‘<button type=”button” data-role=”none” role=”button” aria-required=”false” tabindex=”‘ + i + ‘”>’ + (i + 1) + ‘</button>’; }, } }, ] }); } };} (jQuery, , this, this.document)); When comparing the slick configuration for .js-slick-single-item-center and .js-slick-single-item-tabs, there are different settings for customPaging. This setting allows us to override the default pager markup. Here, we are contextually getting the text from .article__title and adding it to the pager. The pager will still be at the bottom of the slideshow by default. With a few CSS lines, we move this to the top. In the responsive array we revert back to the dotted pager as this tabbed display didn’t work on smaller screens. Note Drupal 10 Maintenance and Support Service slick’s responsive settings are unfortunately not mobile first. You first define your desktop display and then make adjustments for smaller screens within the responsive array. Bring it together Just like the slideshow, we bring this all together in a Twig template. field–field-tabs-tabs.twig.html {# Create classes array #}{% set classes = [ ‘tabs__tabs’, ‘js-slick-single-item-tabs’, ‘slick–single-item-tabs’] %}{{ attach_library(‘THEME/slick’) }}<ul {{ attributes.addClass(classes) }}> {% for item in items %} <li{{ item.attributes }}>{{ item.content }}</li> {% endfor %}</ul> Conclusion As we concluded in the previous post, we like the flexibility theme libraries give us on the front-end. Front-end developers now have the tools they need to implement the latest front-end libraries without waiting for a contrib Drupal 10 module or diving into custom Drupal 10 module development. However, we feel there is another win here. Conceptually, if is our content management system, does layout logic belong in configuration? In most cases, we would say no. The content management system’s job is to load three videos on the page. Whether these videos are presented in a stacked list, a slideshow or content tabs, should be up to the front-end theme. Theme libraries make this possible and give us one more way to decouple our theme. Source Drupal 10 Maintenance and Support Service http Drupal 10 Maintenance and Support Service//dev.acquia.com/blog/rss.xml Source Drupal 10 Maintenance and Support Service Drupal 10 blender
8 DIY Drupal 10 Maintenance and Support Service Creating Content Tabs with Theme Libraries and Slick

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.)
8 DIY Drupal 10 Maintenance and Support Service Creating Content Tabs with Theme Libraries and Slick
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.
