# Remove layout under certain conditions

**URL:** <https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660>\
**Category:** Help\
**Created:** [April 3, 2018, 12:55am UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660 "2018-04-03T00:55:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwirt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mwirt/32/921_2.png) [@mwirt](https://talk.jekyllrb.com/u/mwirt)\
**Post date:** [April 3, 2018, 12:55am UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/1 "2018-04-03T00:55:23Z")

</div>

I have an “events” page that uses jekyll posts to list upcoming events. I am using “default” layout for the events page. That all works great. Now, I want to be able to link to an individual event/post, but I want the individual post to also use “default” layout. The problem is if I give the “post” layout a “default” layout, the individual post links all have it right but the events page is a mess of “default” layouts. How can I have all my posts on one page without a particular layout and have each post have the particular layout when they are on their own? Is it possible to remove a layout from posts under certain conditions?

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [April 3, 2018, 3:40am UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/2 "2018-04-03T03:40:12Z")

</div>

not really giving us much info here, like what theme? the default one?

is there a repo to look at?

It sort of sounds like there are nested layouts of some sort, certainly what it sounds like you want should be no problem. I would look your default layout and see how it works to try and track down why it is happening. And / Or make another layout just for your events page or vice versa.

---

<div class="post-metadata">

**Author:** ![mwirt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mwirt/32/921_2.png) [@mwirt](https://talk.jekyllrb.com/u/mwirt)\
**Post date:** [April 3, 2018, 4:35am UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/3 "2018-04-03T04:35:55Z")

</div>

Sorry I guess assuming others are using Jekyll the way I do is a poor assumption on my part. “default” is what the whole site basically uses–header, side nav, footer, and content goes in the middle. My events page has a for loop for future posts in the content area of default and uses the default layout. This is good. My posts use a layout I call “post” which is just the event info: title, date and time, info about the event. The link to each individual post though has no layout that includes a head, header, nav, footer. Which is what I want. I want the individual post to be in the default layout. But I can’t nest default inside of default it gets wacky. I know there must be a solution to this: how do people get around providing head/structure to individual posts without including that when using the post in tumblr like feed on another page on the site? My repo is private and a little messy right now but I could throw something together tomorrow if necessary.

---

<div class="post-metadata">

**Author:** ![mwirt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mwirt/32/921_2.png) [@mwirt](https://talk.jekyllrb.com/u/mwirt)\
**Post date:** [April 3, 2018, 4:53am UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/4 "2018-04-03T04:53:40Z")

</div>

I already replied but the spambot removed it, I’m guessing because of my proxy…

I’m not using a theme, I started from scratch. My repo is located here: [https://github.com/mwirt/detroitclothingcircle.com](https://github.com/mwirt/detroitclothingcircle.com)

I feel like this must be a relatively common issue with a simple solution I’m just having trouble finding it. How do I make a layout for posts that are on their own, as they are seen at their permalinks, but not when they are in a feed? my default layout is a head, header, nav, footer and some room in the middle for content. I have a “post” layout but its just the post content–title, date, time, description of event, image. I cant give the post layout a layout of default–while it works for the permalink, I get a bunch of heads, headers, and navs in the events page with all the posts. How do people solve this?

---

<div class="post-metadata">

**Author:** ![mwirt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mwirt/32/921_2.png) [@mwirt](https://talk.jekyllrb.com/u/mwirt)\
**Post date:** [April 3, 2018, 4:55am UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/5 "2018-04-03T04:55:35Z")

</div>

I should add, my “default” layout is actually called “base1” I just thought maybe there was a general understanding of the purpose of the default layout which base1 serves.

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [April 3, 2018, 4:34pm UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/6 "2018-04-03T16:34:27Z")

</div>

not sure about this but in your events index.html you have `{{ post }}` and I think maybe that is not correct. If you are building a list of posts like that usually your loop would pull out the title, conent, date, url etc and you build it like that.

I think maybe `post` on its own is putting the whole page in there which is pulling in all the heads and navs and what not.

Try changing `post` to `post.title` and see if you just get the title on its own unstyled.

---

<div class="post-metadata">

**Author:** ![mwirt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mwirt/32/921_2.png) [@mwirt](https://talk.jekyllrb.com/u/mwirt)\
**Post date:** [April 4, 2018, 11:46am UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/7 "2018-04-04T11:46:45Z")

</div>

Alright yes that’ll do the trick. I was hoping for something a bit more DRY than basically recreating the post layout in the events index but I’m not aware of an alternative. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [April 4, 2018, 11:54am UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/8 "2018-04-04T11:54:27Z")

</div>

This is where [Jekyll includes](https://jekyllrb.com/docs/includes/) come into play. Create a posts include that has all the logic and then you can reuse it in multiple places, layouts, whatever.

---

<div class="post-metadata">

**Author:** ![mwirt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mwirt/32/921_2.png) [@mwirt](https://talk.jekyllrb.com/u/mwirt)\
**Post date:** [April 4, 2018, 12:08pm UTC](https://talk.jekyllrb.com/t/remove-layout-under-certain-conditions/1660/9 "2018-04-04T12:08:42Z")

</div>

aha! I knew I hadn’t truly explored the full potential of Jekyll includes. Thank you for the direction, friend.
