Body: <p>I have some routes i want to use like
  &quot;/my-url/locationZ&quot;
  &quot;/my-url/locationX&quot;</p>
  <p>This loads a template /dynamic.twig</p>
  <p>In the template dynamic I am trying to get the content from an existing entry like:</p>
  <pre><code>{% set entry = craft.entries()
         .id('2268')
     %}
  </code></pre>
  <p>But the entry is always null.</p>
  <p>How can I pull the entry into my dynamic.twig template when the route is used?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-31T18:31:00.283Z
Comments.Text: Are you sure the entry exists in your current language?
  You should also always query an entry with `.one()` or `.all()` at the end, because not using those is deprecated as of craft 3.
Comments.UserDisplayName: Joorren
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-01T10:12:42.773Z
Comments.Text: Doh! Needed .one()
Comments.UserDisplayName: joomkit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-01T23:04:13.693Z
Comments.Text: Can you add that as an official answer?
Comments.UserDisplayName: Brad Bell
Tags: <routes>
Title: Setting an entry in a dynamic route template
ThreadText: # Setting an entry in a dynamic route template
  
  (Asked by: username_0 on 2021-03-31)
  
  I have some routes i want to use like
  "/my-url/locationZ"
  "/my-url/locationX"
  
  This loads a template /dynamic.twig
  
  In the template dynamic I am trying to get the content from an existing entry like:
  
  ```
  {% set entry = craft.entries()
         .id('2268')
     %}
  
  ```
  
  But the entry is always null.
  
  How can I pull the entry into my dynamic.twig template when the route is used?
  
  **Tags:** routes
  
  > **Comments:**
  > **username_1**: Are you sure the entry exists in your current language? You should also always query an entry with `.one()` or `.all()` at the end, because not using those is deprecated as of craft 3.  
  > **username_0**: Doh! Needed .one()  
  > **username_2**: Can you add that as an official answer?  
  
  ---
  
  ## 0 answers
  
  