Answers.Body: <p>The <code>entry</code> variable is automatically created for the individual entry pages that you define in your section settings.</p>
  <p>For example, if your Section has the following Site Settings:</p>
  <ul>
  <li>URI Format: <code>blog/{slug}</code></li>
  <li>Template: <code>blog/_entry</code></li>
  </ul>
  <p>You can expect an <code>entry</code> variable to exist when the <code>blog/_entry</code> is loaded.</p>
  <h2>blog/_entry.twig</h2>
  <pre><code>{{ entry.postDate|date('medium') }}
  </code></pre>
  <h2>some-other-template.twig</h2>
  <p>If you are trying to access an entry in some other template, you would need to make sure you define the entry variable on the page.</p>
  <pre><code>{% set entry = craft.entries.id(123).one() %}
  {{ entry.postDate|date('medium') }}
  </code></pre>
  <p>You don't need to query the entry by ID, it was just an easy example. You can use any element query options and read more about them in the <a href="https://craftcms.com/docs/3.x/entries.html#querying-entries" rel="nofollow noreferrer">Querying Entries</a> section of the docs.</p>
  <h2>is defined</h2>
  <p>If you have a scenario where you don't know if the entry will exist or not, you can check for its existence using <code>is defined</code>:</p>
  <pre><code>{% if entry is defined %}
    {{ entry.postDate|date('medium') }}
  {% endif %} 
  </code></pre>
  <h2>debugging</h2>
  <p>If you are curious what does exist, you can turn on the <code>devMode</code> setting in your <code>config/general.php</code> settings and dump the variable to see more about what the application is seeing:</p>
  <pre><code>{{ dump(entry) }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-22T03:43:15.417Z
Answers.LastActivityDate: 2021-05-22T03:43:15.417Z
Answers.UserDisplayName: Ben Parizek
Body: <p>Might be basic, but not sure where I'm doing wrong. I was trying to display the post date of an article using this code</p>
  <pre><code>{{ entry.postDate|date('medium') }}.
  </code></pre>
  <p>But getting the error stating &quot;Variable &quot;entry&quot; does not exist.&quot;</p>
  
Tags: <postdate>
Title: {{ entry.postDate|date }} Variable "entry" does not exist
ThreadText: # {{ entry.postDate|date }} Variable "entry" does not exist
  
  (Asked by: username_0 on 2021-05-21)
  
  Might be basic, but not sure where I'm doing wrong. I was trying to display the post date of an article using this code
  
  ```
  {{ entry.postDate|date('medium') }}.
  
  ```
  
  But getting the error stating "Variable "entry" does not exist."
  
  **Tags:** postdate
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-05-22. Score: 2
  
  The `entry` variable is automatically created for the individual entry pages that you define in your section settings.
  
  For example, if your Section has the following Site Settings:
  
  * URI Format: `blog/{slug}`
  * Template: `blog/_entry`
  
  You can expect an `entry` variable to exist when the `blog/_entry` is loaded.
  
  ## blog/\_entry.twig
  
  ```
  {{ entry.postDate|date('medium') }}
  
  ```
  
  ## some-other-template.twig
  
  If you are trying to access an entry in some other template, you would need to make sure you define the entry variable on the page.
  
  ```
  {% set entry = craft.entries.id(123).one() %}
  {{ entry.postDate|date('medium') }}
  
  ```
  
  You don't need to query the entry by ID, it was just an easy example. You can use any element query options and read more about them in the [Querying Entries](https://craftcms.com/docs/3.x/entries.html#querying-entries) section of the docs.
  
  ## is defined
  
  If you have a scenario where you don't know if the entry will exist or not, you can check for its existence using `is defined`:
  
  ```
  {% if entry is defined %}
    {{ entry.postDate|date('medium') }}
  {% endif %} 
  
  ```
  
  ## debugging
  
  If you are curious what does exist, you can turn on the `devMode` setting in your `config/general.php` settings and dump the variable to see more about what the application is seeing:
  
  ```
  {{ dump(entry) }}
  
  ```
  
  
  ---
  
  