We have a Drupal 8 site with a press releases page. Currently the press releases page is provided by a view with a page display. The path in the page display is set to /press-releases.

I've been tasked with changing the design of the press releases page. We want to use paragraphs to allow the marketing department to edit the page. This means that I must first disable the view's press releases page display (to free up the path), then create a Basic Page (which we've added a paragraphs field to) and set its path to /press-releases.

We use configuration export, so in my feature branch, I've set the "Press Releases" view page display to be disabled when the config is imported.

To speed deployment, I've already created the "Press Releases" Basic Page on production, along with all the paragraphs that we want on it. Of course, it's not published (its current state is "Draft", which in Drupal 8, I'm not entirely certain which module provides those workflow states), because we don't want it live yet.

We use the pathauto module, so when I created the "Press Releases" Basic Page, it automatically generated the path /press-releases-0, presumably because the /press-releases path was already in use by views.

This means that, as a post-deploy step, in addition to publishing the new Press Releases node, I also have to edit the URL alias, from /press-releases-0 to /press-release (the cim command deactivates the view display).

I tried changing the URL alias on the draft node to /press-releases before it was published, but what ended up happening was that on the site, the /press-releases path returned a 404. I confirmed this by looking in the watchdog log, and, sure enough, I got an access denied at /press-releases. Finally, I published the node and cleared the cache. When I reloaded the URL, I got the Press Releases node. So it looks like the node is taking control of that path.

So my question is, is this the expected the behavior of nodes (or entities that take paths in general) in Drupal 8? And that it does this without a form validation error, or a warning or notice that an existing path was overridden? Or is this something that could be being caused by Pathauto or the Draft workflow state?

What concerns me is that any one of our editors (or even myself, as careful as I try to be) could override the URL of a view (or perhaps anything else), simply by specifying an alias for a new node.

(Also, I would prefer to be able to just publish the page in a post-deploy step. Since our deploy process involves deploying to a test and a staging environment before production, extra deploy steps are multiplied.)

Your Answer

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

Browse other questions tagged or ask your own question.