Answers.Body: <p>Craft won't set the <code>entry</code> variable automatically unless the route matches a particular entry. If you're sharing a template between routes that may or may not correspond to an entry, you need to make sure that var gets set explicitly by you if not automatically by Craft:</p>
  
  <pre><code>{% if entry is not defined %}
      {% set entry = craft.entries.section('myStructure').slug('calendar').first %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-02T22:08:22.470Z
Answers.Text: Does't like that `Unexpected token "punctuation" of value ":" ("end of statement block" expected)`
Answers.UserDisplayName: Mark Busnelli Jr
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-02T22:11:20.893Z
Answers.Text: The `?:` is backwards: http://twig.sensiolabs.org/doc/templates.html#other-operators
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-02T22:16:57.233Z
Answers.Text: hmm now getting `Variable "entry" does not exist. but the parent `/calendar` is working`
Answers.UserDisplayName: Mark Busnelli Jr
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-02T22:50:31.773Z
Answers.Text: @Mark I edited the example to include `is not defined`. And it was getting a little long for a ternary, so I converted it to a traditional `if` statement.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-02T23:23:21.580Z
Answers.Text: that did it! thx again
Answers.UserDisplayName: Mark Busnelli Jr
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-03T16:46:38.427Z
Answers.Text: That's what I get for trying to be too terse. Thanks, @LindseyD!
Answers.UserDisplayName: Michael Rog
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-02T22:06:16.720Z
Answers.LastActivityDate: 2015-07-02T22:49:12.860Z
Answers.LastEditDate: 2015-07-02T22:49:12.860Z
Answers.UserDisplayName: Michael Rog
Body: <p>So I have <code>/calendar</code> and linking previous/next months on that template. The previous/next month urls are <code>/calendar/2015-08</code> and <code>/calendar/2015-08</code>.</p>
  
  <p>I have this custom route setup:</p>
  
  <p><img src="https://i.sstatic.net/SFz3u.png" alt="enter image description here"></p>
  
  <p>On my <code>/calendar/2015-08</code> I'm getting this:</p>
  
  <p><code>Variable "entry" does not exist</code></p>
  
  <p>Part of my template looks like:</p>
  
  <pre><code>{% extends '_inc/_layout' %}
  
  {% block meta %}
  &lt;title&gt;{% if entry.metaTitle|length %}{{ entry.metaTitle }}{% else %}{{ entry.title }}{% endif %}&lt;/title&gt;
  &lt;meta name="description" content="{{ entry.metaDescription }}" /&gt;
  &lt;meta name="keywords" content="{{ entry.metaKeywords }}" /&gt;
  {% endblock %}
  </code></pre>
  
  <p>I know why this happening but my question is how do I circumvent this? I want some of the same data on <code>/calendar</code> to be on subsequent monthly calendar pages.</p>
  
  <p>Thanks in advance!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-02T21:59:10.247Z
Comments.Text: What does `entry` refer to in this case? Is */calendar* the Entry URL for an entry, and is that the entry you need to access on the other pages?
Comments.UserDisplayName: Michael Rog
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-02T22:02:55.110Z
Comments.Text: `/calendar` works since it's a structure entry. so yes need that data passed down to other calendar pages.
Comments.UserDisplayName: Mark Busnelli Jr
Tags: <children><calendar><parents>
Title: Monthly Calendar || Month View
ThreadText: # Monthly Calendar || Month View
  
  (Asked by: username_0 on 2015-07-02)
  
  So I have `/calendar` and linking previous/next months on that template. The previous/next month urls are `/calendar/2015-08` and `/calendar/2015-08`.
  
  I have this custom route setup:
  
  ![enter image description here](https://i.sstatic.net/SFz3u.png)
  
  On my `/calendar/2015-08` I'm getting this:
  
  `Variable "entry" does not exist`
  
  Part of my template looks like:
  
  ```
  {% extends '_inc/_layout' %}
  
  {% block meta %}
  <title>{% if entry.metaTitle|length %}{{ entry.metaTitle }}{% else %}{{ entry.title }}{% endif %}</title>
  <meta name="description" content="{{ entry.metaDescription }}" />
  <meta name="keywords" content="{{ entry.metaKeywords }}" />
  {% endblock %}
  
  ```
  
  I know why this happening but my question is how do I circumvent this? I want some of the same data on `/calendar` to be on subsequent monthly calendar pages.
  
  Thanks in advance!
  
  **Tags:** children, calendar, parents
  
  > **Comments:**
  > **username_1**: What does `entry` refer to in this case? Is */calendar* the Entry URL for an entry, and is that the entry you need to access on the other pages?  
  > **username_0**: `/calendar` works since it's a structure entry. so yes need that data passed down to other calendar pages.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-02. Score: 3 | Accepted answer
  
  Craft won't set the `entry` variable automatically unless the route matches a particular entry. If you're sharing a template between routes that may or may not correspond to an entry, you need to make sure that var gets set explicitly by you if not automatically by Craft:
  
  ```
  {% if entry is not defined %}
      {% set entry = craft.entries.section('myStructure').slug('calendar').first %}
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Does't like that `Unexpected token "punctuation" of value ":" ("end of statement block" expected)`  
  > **username_2**: The `?:` is backwards: http://twig.sensiolabs.org/doc/templates.html#other-operators  
  > **username_0**: hmm now getting `Variable "entry" does not exist. but the parent `/calendar` is working`  
  > **username_2**: @Mark I edited the example to include `is not defined`. And it was getting a little long for a ternary, so I converted it to a traditional `if` statement.  
  > **username_0**: that did it! thx again  
  > **username_1**: That's what I get for trying to be too terse. Thanks, @username_2!  
  
  ---
  
  