yorkshirepudding's picture

I think this should be possible but it doesn't seem to work.  I've created page view for events with a page address as calendar 

My default layout is Moscone Flipped but I don't want a sidebar on the calendar page so I want to use Boxton

I created a layout with Boxton as the template, node/% as path and calendar as the URL path visibility condition

I've cleared caches but it still uses the default layout.

Is this actually possible?  Is it failing because it doesn't recognise a Views generated page as being a node?  If so, is there something else I should do?   It does feel like you should be able to assign a layout  Or do I need to do it as a block and create a path based layout?

Accepted answer

...I did try this but you can't create a layout with the path calendar if you already have a view with the path calendar. As far as I can tell anyway. I did try this.

You most definitely can create a Layout with path calendar if you have a View with path calendar. (You need to create the View before attempting to create the Layout, though.)

When you enter "calendar" in the path for the Layout, you will see this text below the "Path" field:

"This layout will override the default layout for an existing page whose path matches this pattern."

And I just did this on my test site, and it works.

 

Most helpful answers

Thanks @bugfolder

I think I had created the layout firstly using node/% and visibility and when I tried to switch to path calendar it failed.  Once I deleted the layout and recreated it as a path calendar, it worked just as you said.

Comments

AFAIK, and as I understand visibility conditions (which may be somewhat wrong) this doesn't work because your layout overrides the system path node/%. The visibility condition in this case would only pass, for example, for a node with a "calendar" alias. But since "calendar" is not an alias of a node page, then the layout is not selected at all, since the main condition is always the main path you entered for it. 

Thanks @argiepiano

So, am I right in thinking that the only way to do this is with turning the view into a block and either:

1. create a node with an alias of calendar and then place the block in the layout

2. create a layout with path calendar and place the block in the layout

 

bugfolder's picture

Hi Martin, if I'm understanding you correctly, you've created a View that has a page display whose path is calendar.

If that's the case, then you should make your layout have the path calendar, and you don't need a visibility condition at all.

@bugfolder. I did try this but you can't create a layout with the path calendar if you already have a view with the path calendar. As far as I can tell anyway. I did try this.

@stpaultim - interesting, I don't have a need for that capability at the moment but I can see that behind useful in the future.

bugfolder's picture

...I did try this but you can't create a layout with the path calendar if you already have a view with the path calendar. As far as I can tell anyway. I did try this.

You most definitely can create a Layout with path calendar if you have a View with path calendar. (You need to create the View before attempting to create the Layout, though.)

When you enter "calendar" in the path for the Layout, you will see this text below the "Path" field:

"This layout will override the default layout for an existing page whose path matches this pattern."

And I just did this on my test site, and it works.

 

Thanks @bugfolder

I think I had created the layout firstly using node/% and visibility and when I tried to switch to path calendar it failed.  Once I deleted the layout and recreated it as a path calendar, it worked just as you said.