Difference between revisions of "Drupal/C3/Menu-and-Endpoints/English-timed"
Line 200: | Line 200: | ||
|- | |- | ||
|06:52 | |06:52 | ||
− | |* Separate words by hyphen and not '''underscore''' | + | |* Separate words by '''hyphen''' and not '''underscore''' |
* Use meaningful, human readable words in the '''URL''' for '''search engine optimization (SEO)''' | * Use meaningful, human readable words in the '''URL''' for '''search engine optimization (SEO)''' | ||
Line 225: | Line 225: | ||
|- | |- | ||
|07:46 | |07:46 | ||
− | |'''delete | + | |'''delete aliases''' and '''bulk generate aliases''' at any time. |
|- | |- |
Revision as of 15:31, 3 September 2016
Time | Narration |
00:01 | Welcome to the Spoken tutorial on Menu and Endpoints. |
00:06 | In this tutorial, we will learn to set up URL Patterns. We will also learn about Menu management. |
00:15 | To record this tutorial, I am using
You can use any web browser as per your choice. |
00:29 | In this tutorial, we will talk about the process of creating proper URL paths for our website. |
00:36 | Endpoints and aliases- Endpoints are URL paths which display a particular content. |
00:45 | By default, in Drupal, the endpoint of a node is node/[node:id]. |
00:53 | Sending this to a server will display the contents of the node. A number in the ID is not human readable. |
01:02 | That is, we cannot easily associate a particular content with say, node/278162
A human readable endpoint is available by creating an alias. |
01:19 | Alias is an alternate URL path for the same content. We can use either the original or any one of several aliases, for displaying the same content. |
01:34 | For example, node/278162 and content/drupal-camp-mumbai-2015. |
01:47 | Both return the same content. The second one is easy to remember. |
01:54 | Let us now create URL patterns that will apply to all the contents we have. |
01:59 | Setting up URL paths require three modules. |
02:04 | Those three modules are the Pathauto, Token and CTools. |
02:13 | Please go ahead and get the Pathauto installed on your machine. |
02:18 | Come back to the Pathauto project page. Here, you will notice that Pathauto requires Token and CTools. |
02:27 | Install Token and CTools. Once you have installed these modules, turn them on. |
02:37 | Once we have done that, we are ready to go. |
02:40 | Click on Configuration. Down here, on the left hand side, under the SEARCH AND METADATA section, you will see URL aliases. |
02:52 | By default, there are no URL aliases available. |
02:58 | Click on the Patterns tab. Click on the Add Pathauto pattern button. |
03:05 | Click on the Pattern type drop down. |
03:09 | Here we can create separate patterns for Forum, Content, Taxonomy term and User. |
03:17 | For example, I will select Content.
In the Path pattern field, we have to provide the pattern template. |
03:27 | Template variables are called as tokens. They are dynamically generated for each entity. |
03:36 | Token module provides these variables. When you see Browse available tokens in any input form, you can insert pre-defined tokens. |
03:49 | Click on the Path pattern box where you want to insert a token. |
03:55 | Type "content/". Then click on the Browse available tokens link. |
04:02 | A popup window opens up to show the "Available tokens". |
04:07 | Suppose we want a pattern like content/[title of the page], the token for the title of the page is under the Nodes section. |
04:18 | Click on the right arrow button of the Nodes section. |
04:23 | Choose the token [node:title] which will be replaced by the Title of the page. |
04:32 | This will insert [node:title] at the cursor location in the form box. |
04:38 | If this does not happen, make sure to click on the box and position the cursor as required.
Then select the token again. |
04:49 | Under Content type, we can select to which entity type this pattern should be applied. |
04:56 | Let us select all the types so that this pattern is default for all of them. |
05:04 | This setting can also be overridden for a particular type.
Example: we can create usergroup/[node:title] and apply it only for User Group. |
05:18 | In the Label field, type "Content Title". Then click on the Save button. Here, we can check the new pattern we just created. |
05:31 | This pattern will be applied to generate URL aliases for all newly added contents. But it will not create the URL aliases for existing contents. |
05:45 | To apply it for the existing contents, click on the Bulk generate tab. Select Content type and click on the Update button. |
05:58 | It is started generating the URL aliases. It can take a while depending on the number of existing contents. |
06:08 | Now click on the List tab. We can see that the URL aliases for our content. |
06:15 | Each node on our site has a system path of /node/nodeid. |
06:24 | The newly generated URL alias is there in the first Alias column. |
06:30 | We can see that all the aliases follow the same pattern. You have to do this each time you create a new Content type. |
06:41 | Use the following thumb rules to create patterns.
|
06:52 | * Separate words by hyphen and not underscore
|
07:07 | * Use date tokens for contents classified by time. |
07:12 | There are more options available to control the URL alias pattern in the Settings tab.
Here we can see default Separator, length etc. |
07:26 | We also see that, by default, several common words are removed from the pattern.
This is to keep the endpoint compact and meaningful. |
07:38 | To summarize -
Pathauto and Token modules allow us to
|
07:46 | delete aliases and bulk generate aliases at any time. |
07:52 | From now onwards, every new node will use the patterns that we have established. |
07:59 | Now, we will talk about the Menus. |
08:03 | We have been adding menus to our site, in a random order, mostly based on the Views and basic pages. |
08:10 | Now, let’s see how we can manage the menu system. |
08:15 | Go to Structure, scroll down and click on Menus. |
08:21 | We have a number of different menus here that come with Drupal, by default.
We have six menus, to be exact. |
08:31 | We are interested in the Main navigation menu. So, click on Edit menu. |
08:38 | Here, we will be able to click and drag and re-order our Menu links. |
08:44 | Let’s drag Home and Upcoming Events to the top. |
08:49 | You can re-order these, in any way you want. Once done, click Save. |
08:56 | Now we have got Events and Upcoming Events.
Let’s click and drag Events to the top and then drag Upcoming Events to the right. |
09:07 | This will create a sub menu. |
09:10 | That’s pretty simple. Click Save and take a look at our front page. |
09:15 | Notice that now we have got four menus. |
09:19 | Where did our Event sub menu go? |
09:23 | Please remember, not all themes in Drupal support sub menus or drop-down menus. 'Bartick theme is one of them. |
09:32 | For now, go back to Structure, Menus and edit the Main menu.
Drag Upcoming Event back over here and click Save. |
09:44 | What if we need a link to a particular node or to a particular section of our site? |
09:51 | For instance, if I wanted a menu link for my Forums, I would first go back to the site. |
09:58 | Go to the Forums page and copy the actual URL which is just /forum. |
10:05 | Then come back over and click on Edit menu and then on Add link. |
10:12 | Give it a title called Forum and paste the copied link. |
10:17 | If you are looking at a specific piece of content, just type a letter like ' F' or 'G'.
All the nodes that start with that letter, will show up. |
10:28 | Say, for instance, if we type an 'a' , all the nodes that have 'a' in the title, will show up. |
10:38 | We can just select the one we are looking for and it will tell us that its node id number 1. |
10:46 | If we want an internal path, such as the ability to add a node, then it would be /node/add. |
10:56 | If we want to link it to the Homepage, it will be front.
But we want /forum here which is a link to the Forum. |
11:08 | Click Save and now we have a link to the Forum. |
11:14 | Click Save. Let’s just double check if that works and indeed it does. |
11:21 | So, play around a little bit to understand it better.
With this in our menu system, it will be easier to create Menu item for a View or a Content Type. |
11:34 | With this, we come to the end of this tutorial. |
11:38 | Let us summarize.In this tutorial, we learnt about:
|
11:59 | This video is adapted from Acquia and OSTraining and revised by Spoken Tutorial Project, IIT Bombay. |
12:09 | The video at this link summarizes the Spoken Tutorial project. Please download and watch it. |
12:17 | The Spoken Tutorial Project Team conducts workshops and gives certificates. For more details, please write to us. |
12:26 | Spoken Tutorial Project is funded byNMEICT, Ministry of Human Resource Development and NVLI, Ministry of Culture, Government of India. |
12:39 | This is Calvin Nikhil Tomy, signing off. Thanks for joining. |