2

Help me understand the best practice on how basic site building should work in Drupal 8.

Say I have a section on a website that is all about teaching. I'm going to create a basic page content type that has a title, body and various paragraphs elements that a user can add to the page. I then create the page called Teaching and say to add it to the main menu as this is going to be a main section of my website and then use URL alias to make the URL website.com/teaching.

Now, I want to add another page to my website which should fall under the Teaching branch of the site and call it Learning Cafe. Would I just go and use the same Basic Page content type and add all the info to it, and then add it to the main menu except as a child of the Teaching menu item? If I was to do this, wouldn't I just end up with a URL of website.com/learning-cafe instead of what I really want, website.com/teaching/learning-cafe?

How do I tell Drupal that this new page should be a type of "sub-page" in the Teaching section of the website? And how do I use URL aliases to automatically create the URL as a sub-section of /teaching instead of manually doing this for every page I create? I mean, yes I could do it, but when I hand the site off to non technical people, I wouldn't expect them to know to do this.

Also, if I do it this way, the breadcrumbs don't recognize this as being a sub page of Teaching. Instead of showing Home / Teaching / Learning Cafe, I just see Home / Learning Cafe.

Am I going about this the wrong way? Am I overthinking? If I could get a thorough explanation on how this should be done properly, that would be great. I feel like I know quite a bit about how to use everything else in Drupal but the site building portion of it seems to be confusing me.

Also, if more information is needed, let me know and I'll try to answer it.

2

If you add the node under another node in the Menu section of the node form, that page is the child of the page you set it to in the menu.

You need Pathauto to configure automatic aliases to get what you want, URL alias wise. You may also want Menu Breadcrumb to get the breadcrumb to behave a bit better and follow the menu.

As far as the 'page' content type - this is a fine approach. The differences in content types comes down to their purpose and field set. If you are creating five nodes, and theres virtually no difference between them or anything unique (like say, Article vs Product vs Job listing vs Page where fields may be different) - being a Page is fine. To understand your needs better, you should probably flesh out a content wireframe or information architecture / sitemap document. It will help you identify content, and their differing types, which will help you plan their fields and other configurations.

  • Thanks @Kevin, this makes sense but how would I set up Pathauto to understand what I want done? Like what if I created a basic page to go under another heading (say Curriculum), how would Pathauto know that this Basic Page needs the /curriculum URL instead of /teaching? Would it make more sense to create a Basic Page content type for each menu item that I planned on having? – ACanadianCoder Jan 12 '17 at 19:21
  • No don't do that. Install Pathauto and configure it. The docs and issue queue have examples of how to use menu parent tokens to setup automatic aliasing. It will know what to do. I don't have the exact token offhand, but the most common one is something like [node:menu-parent:join:/]/[node:title] which creates an alias based off the parent menu path, then attaches the current node title. If no parent (i.e. teacher), then it is just the title. – Kevin Jan 13 '17 at 0:54
  • Excellent! Thanks Kevin! I have used Pathauto before but didn't know that it had tokens that could be used that way. This makes more sense to me now. The only other question I would have then would be: When a user goes and creates a new Basic Page, they would always be given the permission to select where in the menus this page should go, correct? Like there's no automatic way for Drupal to know where these Basic Pages should go otherwise then? – ACanadianCoder Jan 13 '17 at 2:14
  • Yes they should be able to select wherever in the menu structure they feel the page should live. If you also add on the Redirect module, it will correct mistakes and 301 old urls to the new one if they move nodes around the menu. Basically, creating content types that have no differing aspects is kind of a waste and just more 'things' to maintain. The rest is just really good content entry training. – Kevin Jan 13 '17 at 2:16
  • Makes sense. Thanks again for everything. You've definitely enlightened me when it comes to this aspect of content building. – ACanadianCoder Jan 13 '17 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.