Drupal Strategies: Landing Pages
Imagine if you will, you have an Events link on your main menu. Someone clicks on it and the Events landing page is loaded in their browser. How was this page built? With Drupal, you have several options.
If you are the kind of person who likes to have a say in the way things are done, be it from a previous bad experience or idle curiosity, the following will help you engage in the planning aspects of your Drupal site. So, let’s look at five recipes for building landing pages in Drupal.
- Node page
- Node Plus View Block
- A View Page Plus a Block
- Panel Page
- Custom Theme Page
Content pages in Drupal are called nodes. You fill out a form (e.g., a content type) online, save, and you have an article or event or some other kind of page. This page has a URL. That’s important to remember. Every page in a website has to have a URL.
Using Drupal’s default Basic Page content type, you fill out the form. Give the page a title of About Us. Fill in the body field with information about you or your company. Add it to the main navigation menu with a check of a box. Lastly, you create an URL alias. Instead of the default format of /node/3, you want /about-us. Save and you see your new landing page.
Yes, it’s boring, but we’re just getting warmed up.
Simple page. Simple technique. Easy to create and edit. Easy to translate in a multilingual site. And let’s not forget the other cool things you can do with a node.
Node Plus a View
Building on the previous example, let’s build an Events landing page. Obviously, this kind of page is going to be a little more complicated. Here are the requirements: a title, some introductory text, and a list of Events that you created using an Events content type. You will have many events so using a manual approach to creating and updating a list of events is not a fun idea.
With this scenario, you use the Basic Page content type and create a node titled Events. Using the body field, you add some text that describes your events. Like before, check the box to add this node to the main navigation. Give your page the URL alias of /events. Save and the first part of the configuration is complete.
The next step in the configuration process is a little more complicated, but it’s the concepts you need, not the details at this time.
Drupal has a module called Views. It’s an incredible tool that lets you create an SQL query on the database and then create a display for the results of that query. For this landing page, you need events for the future, not the past, so you filter accordingly.
Given we already have a Drupal feature with its own URL (the event node), we don’t need another. That means you will create a block display for the SQL query results. Blocks can be small bits of information or larger, more complicated displays. They can even hold forms. What they don’t have is a URL. They only show up because a page is there to host them.
Without going into all the particulars, you will place the block so it appears under the body field.
When you go to the yoursitename.com/events URL, you will see the Events node and the view block that lists the upcoming events. With some styling, you can make the two features (node and view) appear as one, seamless page.
Some will argue that you could have made a View page versus using this two-step process. And, in the next example, you will. In this scenario, you looked ahead and saw that the introduction text would not be a fixed blurb. You will change it from one season to another and your staff will not have the skills to edit a View.
So, this scenario worked nicely for your business process and staff.
A View Page Plus a Block
Let’s change up the requirements as a means of introducing another build option. You need a list of events, but instead of some introduction text, you need an image banner. There are several ways to accommodate this new image requirement, including adding to the previous scenario. In this example, we will use a View page and a block.
Create an SQL query, grabbing all the events scheduled for the future. Instead of displaying the list of events in a block, you create a page with a URL of /events and place it on the main navigation menu.
Next, create the block that will display your image banner. Like with most requirements, Drupal provides several alternatives to meeting them. For this scenario, assuming you are using Drupal 8, create a new block type called Image Banner. Add an image field to the new block form and set the field display to show only the image.
Create a block, using your new block type. Upload the image you need for the Events landing page. This process is very similar to creating a node. The input form looks similar as well.
Place the banner image block either above or below the page title block to match your design. This is a quick and easy way to insert an image above the title of the page if that is your choice.
A View page isn’t like a node. It doesn’t have fields. You can add a header and footer text, but it’s not the same as adding a field to a node. Bottom line, a View show the results of a query - typically that of nodes. So, if you need to display information other than the query results, you might need to use methods like described above, by adding blocks or combining a node with a view.
Another reason for mixing and matching features to create a landing page is display. By default, a Drupal page—node or view—is broken into two parts: Title block and Main Page Content block. If we had chosen to add an image to the available header text box in the view, the image would appear below the page title. Yes, you can do some template coding and rearrange things a bit, but why would you if you could simply place a block and accomplish the same goal.
The point of all this is, remember that content comes in parts in the Drupal world, and quite often, a simple mix and match strategy is all that needed.
Taxonomy View Page
A technique that can be overlooked is the use of the default taxonomy term page. A term is a word or phrase used to describe the content in the node. By default, a term page displays when someone clicks on a term link shown on a node. The page provides a list of nodes tagged with that term.
Let’s see how this default feature might be used to create landing pages by changing our focus from Events to types of content.
Imagine that you have three types of content that will be placed in a body field: How-to Lessons, News, and Blogs. Instead of creating three separate content type forms, you add a field that assigns terms to the content, declaring it a How-to Lesson, for instance.
By default, the How-to Lesson term has its own landing page. In Drupal 8, the term page is a View page and can be modified to meet your display layout needs.
Let’s take this scenario one step further. It’s come to your attention that you need a banner image and introduction text to appear above the list of nodes tagged as How-to Lesson. In this scenario, you can add an image field to the term and use the description field for your introduction text.
The results are very similar to what we have created in the previous scenarios: a page title, and image, some text, and a list of nodes. Place the page URL on the main menu and you have a landing page.
Hopefully, this demonstrates the need to think about your processes before choosing a configuration strategy. There are several steps involved but it’s actually quite easy to learn how to do in a Drupal training class.
Websites can be complex and that might mean multiple content types. However, imagine that one of your staff is blogging the latest insight on gardening strategies and it morphs into a how-to lesson. If they created the blog post in the Blog content type, they would need to move that content to the How-to Lesson content type instead.
If this is something that might happen, create one content type for narrative content and use terms to distinguish between them. If you do, you can then take advantage of the term’s default pages, as demonstrated in this example.
So far, our examples assumed simple displays. What if you want to create a landing page whose content is built solely from blocks. Basic text blocks. View blocks. Blocks from other modules. Again, there are several ways to make this happen, especially if your theme (that bundle of code that controls the look and layout of your site) has the appropriate regions to organize your blocks in the way you need.
For now, let’s assume you need something unique.
Panels is a module that you can add to Drupal. It provides a graphic user interface (GUI) and allows you to create a page with its own URL that can be assigned to the main menu. Remember, if you need a page in Drupal, it has to come from something that can have its own URL. You can also create a custom layout to display blocks.
Some will say that you should create the theme regions you need versus using Panels, and they would have a valid point. However, if by now you are intrigued with the build process and are wondering if you might be able to do it yourself, then a tool such as Panels doesn’t require you to know how to customize a theme.
Of course, with training, a custom theme is something you can manage. In fact, let’s consider one way of using a custom theme to create a page on your site.
Custom Theme Page
Let’s take a moment to consider the Drupal theme. Without going into all the details of theme development, at a minimum, you need to know that the theme defines the regions (header, navigation, sidebars, content, footer, and more) used to organize and display blocks. It also manages the templates used to say what gets rendered in the region.
For example, there is a page template. This renders the region if there is a block assigned to show in said region. You can add as many regions you want in order to accommodate the various block layouts you need.
You can also create a template for a single page. Let’s consider this strategy for a moment.
Assume that you created a node using the Basic Page content type and titled it Resources. In the theme, you create a template specific to this node. At this point, it’s all about hand coding. You create a template that renders all the blocks you have created to display on this page. Then, with some CSS, you style the blocks in a layout of your choosing.
With the Resources node assigned to the main navigation menu, you have the page you need because its custom template is hard coded.
To be honest, although this blogger has seen this approach used, it is not conducive to making quick changes to the page. Why is it listed as an option? Because, depending on who you hire to create your site, you might end up with a vendor that uses this technique. Be it on purpose to gain maintenance business from you or just from lack of Drupal building experience, you could end up with a site that does not take advantage of Drupal’s flexibility.
Make sure you are specific in your requirements regarding the use of custom code if this is a concern.
Planning and Promet
The five options conveyed here are not the only options you have available. Moving forward, consider taking an active role in the development strategies chosen to create your site to ensure you receive a solution you can manage.
Remember to build in time in your schedule to have development strategies discussed before they are implemented. If your developer is reluctant to let you in on their plans for meeting your requirements, they might not be the vendor for you.
If you still have questions, check out The Path to Migration to learn more about your options and considerations for your project.
Promet offers a unique planning engagement that we call our Architecture Workshop. This workshop is a customized engagement that engages all of your stakeholders in the Discovery Process. We do a 3-5 days of intensive onsite exercises with stakeholders (for your busy C-level folks we customize the agenda to bring them in where they are needed during this onsite).
Then the team goes away and produces a set of deliverables that includes a full-field level Architecture Blueprint of the website(s). Whether you choose to use a waterfall or agile development methodologies —you have everything you need to build the website everyone has agreed upon.
Not building your site and stressed out about getting an accurate quote? Investing in this kind of Workshop will make sure that you get the right Partner, and the best price.
For more planning information, fill out our contact form.