I've been building a Drupal 8 site over the past month that should have a stupid simple page hierarchy similar to this:
Parent Page
--Child Page
--Child Page
----Grandchild Page
----Grandchild Page
----Grandchild Page
Parent Page
--Child Page
----Grandchild Page
------Great Grandchild Page
--Child Page
I really would have thought this kind of normal Parent-child page structure hierarchy would be built into Drupal and be reflected appropriately in the breadcrumbs, but apparently it isn't, with Drupal defaulting to an absurdly flat model where every page is assumed to be a direct child of the home page (e.g., "home > event1" instead of the more categorically and structurally descriptive "home > events > event1"). In this respect breadcrumbs are maddeningly useless from a usability perspective, offering users literally no sense whatsoever as to where structurally in the site a given page is.
I've found a hierarchy that reflects properly in the menu, breadcrumbs and pathnames CAN be achieved in an automated fashion somewhat, if I simply add absolutely every single page created as a link or sublink in the main navigation menu structure. However! In some cases I have 70+ pages that are children of a parent page, so making every page part of the main menu is out of the question: in some cases I would want to display the parent page, and have the parent page act as a listing of the children pages.
I've also heard of using a Taxonomy, but I can't find any useful and sufficiently descriptive literature explaining how exactly to implement, or to accurately reflect the taxonomical properties in accurate breadcrumbs or url aliases. I would be sore indeed if I'd have to manually configure and maintain the breadcrumbs and url alias paths and their relationships for each of the hundreds of pages on the planned site.
I've also heard of using the "Books" module. Though what I'm developing may be structured similarly, I'm simply not making a book, with multiple interconnected navigable pages with chapters, sections and subsections. It seems to me beyond the pale to twist a module with functionality intended for a completely different purpose only similar to my needs as a janky ad-hoc fix.
There is a module called "Node Hiearchy" that ostensibly achieves the basic functionality I'm looking for... but to my chagrin the module isn't updated for Drupal 8 yet (a painful dawning realization about the state of useful Drupal 8 module availability as I continue learning/developing).
In short: Is there a way to implement the kind of stupid basic hierarchy I'm looking for in Drupal 8 with working breadcrumbs and url aliases? Or will I have to retrofit all of the past 2 months worth of work by downgrading everything to Drupal 7 just to get access to the Node Hierarchy module?
For Drupal 8 one possibility is Entity Hierarchy
You can apply a page hierarchy, but only one level deep. So in your example you'll be able to list "Events" on "Home", and you'll be able to list "Event-1, 2..etc. on "Events". But you will not be able to display "Event-1..etc" on Home.
Don't forget to grant the Anonymous role "Entity Hierarchy Views: Access embedded child view".
Related
Am working on a simple page using Wordpress. It's a simple web with mostly static content that is going to be updated rarely, let's say once per month.
The content will consist of cca 20 pages that are going to be edited by the site admin. No posts, no discussion forums or so.
I need to localize these pages to three langauges. My idea is to create three versions of each Page and that's it. Let's say index_en, index_de, index_es etc. So far so good.
But there is going to be a custom theme with generic header, footer and menu and all these will contain strings that needs to be translated. I intend to have language switcher in the header (probably small flag icons) and on language change I would navigate to relevant page eg. "index_de" for German. But how can I change the language for the theme itself - the strings in the header, footer and menu...
My supplier offers me three options
automated translation by Google Translate (not a good option)
tree installations of Wordpress - one for each language, not very comfortable from maintenanace point of view
plugins (TranslatePress, WPML, ...), always paid as recurring subscription. Not very good option from costs point of view.
I really can't believe there is no simple option for such a task that nearly everyone needs to resolve... Any ideas how to do that?
thanks
Jiri
A client asked me to redesign her web site, built several years ago in WP by another developer. Although I've never worked with WP before, I'm pretty comfortable with html, css, and php, and I more or less understand how WP stores content and dynamically builds pages. But I'm wondering how to approach these challenges:
My client's site has about 75 pages. There are about 25 that are static (i.e. the content changes infrequently if at all; things like "about us" and "faqs") and there are about 50 pages that are more "blog-like", except that instead of posts, the content contains directory-type info (e.g. 12 DJs in the area) or event-related info (e.g. upcoming shows at local theaters). Both of these categories contain many sub (and sometimes sub-sub) categories (e.g. medical services > pediatric > kid allergy specialists) and the content updates fairly frequently.
I understand the difference in WP between "pages" and "posts". But I need to find out the best way to structure the static content. Should I just set up a parent/child hierarchy of pages, changing the permalinks to something that makes sense? Or is it better / easier to just build the static pages outside WP and somehow link to them from the common navigation?
As a web designer, I want to "wow" my client with a great design. While there are loads of wonderful WP themes available, I really need to create something unique. But I'm wary of breaking something, so what's the best way to take an existing theme and just tweak it enough to make it look a little different?
Finally, other than mounting a massive "copy and paste" effort when the new site is built, is there a way to transfer content from the original site to the new one?
I would create a Child Theme (https://www.hostinger.com/tutorials/how-to-create-wordpress-child-theme). And just do your changes in this theme.
You can download the complete Website with a plugin like duplicator and install it local (xampp).
Is hard to give you the right way. There are so many ways a theme can look like. Different page builder plugins or Advanced Custom Fields.
Maybe the only thing you can do, is to update (Theme, Plugin)everything and lift the page. Especially if it is a purchased theme with any page builder. But don't change anything in the main theme. Create a child theme!
I understand the difference in WP between "pages" and "posts". But I
need to find out the best way to structure the static content. Should
I just set up a parent/child hierarchy of pages, changing the
permalinks to something that makes sense? Or is it better / easier to
just build the static pages outside WP and somehow link to them from
the common navigation?
It's not something like that. Consider the child theme as inherited (like a PHP class) from the parent theme. Imagine every .php file in a child theme is like overriding a function from parent class which is parent theme in this example.
For more information check the codex out or google "wordpress theme vs child theme" there are lots of articles explaining the difference.
In a typical WordPress project I guess there are 3 parties. Party 1 is the graphic designer providing psd/pdf or html that party 2 (the developer) will create a theme from with probably some custom posts so party 3 (the client and content editor) can update the site without messing up the design and with no knowledge about HTML, JavaScript, Gimp or PHP.
This would tie the main theme of the site or it's specific pages in the php page(s) and if some minor design changes need to be made it needs to be done through editing php files.
I was thinking the following for a theme design:
(assuming a content only site without having complicated sales statistics and such)
Instead of "programming" the page.php to fit the graphic design and bring in specific (custom) posts and other data I would have the page.php bring in sub content. This so the graphic designer can create the page without having to program.
When images need to be provided then wordpress can pre scale/crop for different screen sizes.
The entire page should be created from the editor by the designer NOT the editor/client and not in page.php:
<html {{lang}}>
<title>{{title}}</title>
...
{{main-slider}}
JS and css are added through custom fields so they can be merged to one file.
Main slider post looks like this:
<div id="main-slider">{{main-slider-content}}</div>
JS and css can be provided to overrule page css or js and will be merged to one file.
And the main-slider-content is content that the editor can provide through a custom post provided by the programmer that will hold the editor's hand all the way and makes sure everything goes right.
Some of these fields can be set with custom fields values of the page (reverting to defaults if missing) some will be overwritten by the post (like language or title).
The type of sites that will be produced by this theme are used by small business owners who would like some web presence.
I have a couple of doubts about the design and hope someone with more experience with wordpress can shed some light on this.
When the editor/client edits a custom post like some slider content they cannot preview the item because that content is basically used on every page. Even if I find a way to list pages where the slider is used and show that one it won't show the new content until it's published. Previewing pages seems a bit complicated to implement.
It takes longer to generate the pages because content and sub content needs to be fetched from the database after parsing the content. I've tried to do this with DOMDocument before and used <div data-custom-content="main-slider"></div> but that is too slow so I'll try with regexp.
Because content isn't going to change that much I thought maybe APC cache the page after a first request and serve it from there. Delete the cache only when something is updated. On VPS the cache could be (probably would be) trashed when the site is inactive for a long time (which would be quite often). This means that requests take a long time to process when people try to view the pages.
Anyone with experience or helpful tips in this
[UPDATE]
I see that particular design and the html template will still have strong dependencies on each other. I am thinking now of trying out Twig. The benefit will be that re usable components are classes that can be added to the project and full content is controlled in the wordpress editor in a way that someone with no programming experience can still manage the content.
When data needed in the page is going to change a programmer is going to be needed though.
This is kind of what the Advanced Custom Fields Flexible Content system does, and the way you've styled your examples looks very like Smarty, a templating system that used to be very popular, and which is still used by a few systems like Prestashop.
In my experience, this removing the middleman kind of idea doesn't work. You either need a very extensive - and therefore bloated - initial theming system to flex to different projects, or you need a basic one which a developer will customise later - in which case the best you can achieve is moving the developer's role to a different phase of the project.
Overall, I think the best scope for this type of idea is for designers to learn a bit more code.
I am currently looking at using either the Taxonomy or CCK module on my Drupal site as a means to create a hierarchical system. However, I'm a little confused on which one would best suit my needs, or if there is something else that would work better.
Basically, there will be probably 70 or so "mini-sites" on the website I'm working on, each with a landing page and about 5 sub-pages of detailed information. I need a way to mark those sub-pages as being sub-pages of their parent page, as well as create a menu system to navigate between them.
What is the best way this could be done? Thanks for your input!
Have you tried using the Book module? It might take a bit of theme-adjusting to get it to look right it seems to be how most people settle on displaying this type of page structure.
Depending on your needs, Organic Groups and/or Spaces can be a good alternatives, since it'd allow you to easily control themes, permissions and other settings in a mini-site basis.
Each Mini-site would be an OG node and/or a space, and subpages could be organized in tree structure as well, using Book module from Drupal Core.
The best option is the book module. It gives a way to organise hierarchical content in a book manner. There are 2 blocks generated automatically: the book navigation and the book outline which gives, for each page, a link to the previous and the next content.
For more information drupal handbook: http://drupal.org/handbook/modules/book
A client asked me to redesign her web site, built several years ago in WP by another developer. Although I've never worked with WP before, I'm pretty comfortable with html, css, and php, and I more or less understand how WP stores content and dynamically builds pages. But I'm wondering how to approach these challenges:
My client's site has about 75 pages. There are about 25 that are static (i.e. the content changes infrequently if at all; things like "about us" and "faqs") and there are about 50 pages that are more "blog-like", except that instead of posts, the content contains directory-type info (e.g. 12 DJs in the area) or event-related info (e.g. upcoming shows at local theaters). Both of these categories contain many sub (and sometimes sub-sub) categories (e.g. medical services > pediatric > kid allergy specialists) and the content updates fairly frequently.
I understand the difference in WP between "pages" and "posts". But I need to find out the best way to structure the static content. Should I just set up a parent/child hierarchy of pages, changing the permalinks to something that makes sense? Or is it better / easier to just build the static pages outside WP and somehow link to them from the common navigation?
As a web designer, I want to "wow" my client with a great design. While there are loads of wonderful WP themes available, I really need to create something unique. But I'm wary of breaking something, so what's the best way to take an existing theme and just tweak it enough to make it look a little different?
Finally, other than mounting a massive "copy and paste" effort when the new site is built, is there a way to transfer content from the original site to the new one?
By reading your question, it seems to me that choosing WP for this kind of website was a bad choice.
Redesigning it, though, won't be that hard if it's using page templates for pages.
And yes, there's a import/export tool in WP to tranfer content. (see administration panel)
I, really, advise you to read this great tutorial about creating WP themes.
I've a blog-like WP site myself (contains RPG development articles). Here's what I did. Nested static pages simply have parent-child hierarchy: /about/mingos - that's easy to understand and i value this kind of content organisation (personal opinion).
As for themes, there's a no-brainer tool that, while not exactly apt for real business, has the capability of letting you see how stuff will look in seconds, and can sometimes give you great ideas. It's called Artisteer and there's a demo on its site that you can have a look at. Try your design ideas with it, see how stuff will look like. I'm sure you can come up with some great ideas for a "wow" design :).
Exporting content, as Soufiane Hassou remarked, is possible from within the admin panel.
Don't rule out using categories to create your hierarchy. That way you'd get the benefit of cross categorization of DJs and venues by location to create a robust cross reference system. Pages don't get this benefit without extra work.
To make this in to a directory, though, is gonna either be heavy work on managing the pages or heavy work on creating a solution that will cross reference everything and bring the content together in a usable way on the front end.