Tip:
Highlight text to annotate it
X
I'm Chris Shattuck, and this is 'How to Work With Pathauto and Introduction to Views.'
In this chapter, we're going to install and configure Pathauto, a module that will allow
us to create URL aliases automatically, then we'll begin building our calendar view with
another powerful module called Views.
In the last chapter we created a new content type called Tour, and in this chapter we're
going to begin by adding new tours via the Add content form. Let's go ahead and begin
by clicking the 'Add content' link in the shortcut bar. And now let's go ahead and click
'Tour' to add a new tour page.
Let's take a quick preview of the inputs, because we added them in the previous steps
but we haven't previewed our form yet. So we have our event name and description. I'm
going to go ahead and scroll down. We have our location, tour type, dates and guide.
OK, pretty simple inputs here.
Let's go ahead and begin filling out some data. I'm going to go ahead and jump to the
date sheet that we have. And let's go ahead and start at the top with the Mount McKinley
Club September Meeting. I'm just going to go ahead and copy this content and add it
as the title. And then we're going to leave the description blank, because there's no
description yet. I'm going to go ahead and scroll down to Location. Let's go ahead and
copy Anchorage as the location, and paste it in. I'm going to copy 'Mountain climb'
and paste it into the tour type. I'm going to copy the dates and paste it into the Dates
input. And finally, I'm going to copy the guide and paste it into the Guide input.
Now I'm going to scroll down, and let's take a quick look at these options. We don't want
to create a new revision. Let's check the URL path settings. OK, so we need to create
a URL alias for this particular tour, and it make sense on a lot of levels�both for
search engine optimization and for leadability�to go ahead and use the title as a URL alias
for our page. The trouble though, is that this is kind of an extensive title, and it
contains a lot of characters that we don't want. For example, there's uppercase characters
that we need to convert to lowercase, and there's a period, and a comma and spaces,
and none of those work very well in a URL. It's much better to remove those characters
that shouldn't be in URLs, convert the spaces to dashes, and convert everything to lowercase.
To do this manually is possible, but it's kind of a pain, and it's error-prone as well.
And if you're expecting your end users to do this as they add content, chances are they're
going to take some shortcuts. Lucky for us, there's a module that will automatically take
a pattern that will include your title, and convert that to your URL alias by default.
And it's called Pathauto.