Answers.Body: <p>You could use either <code> | last</code> filter instead of first or, a combination of first and another conditional ( segments[1] is empty or similar)?</p>
  <pre><code>{% set segments = craft.app.request.segments %}
  {% if segments | first == “projects” and segments[1] is empty %}
  Load scripts
  {% endif %}
  </code></pre>
  <p>On phone so ymmv</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-04T00:22:12.103Z
Answers.Text: You might also be able to just test craft.app.request.uri or something (path?) check the request docs?
Answers.UserDisplayName: billythekid
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-04T00:20:48.280Z
Answers.LastActivityDate: 2020-07-04T00:20:48.280Z
Answers.UserDisplayName: billythekid
Answers.Body: <p>You might check if <code>projects</code> is part of URL:</p>
  <pre><code>{% if 'projects' in craft.app.request.segments|split('/') %}
  Load scripts
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-04T07:47:40.097Z
Answers.LastActivityDate: 2020-07-04T07:47:40.097Z
Answers.UserDisplayName: Piotr Pogorzelski
Body: <p>I'd like to only load some scripts for 1 specific page with the Url <code>/projects/</code>.</p>
  <p>Currently I'm using:</p>
  <pre><code>{% if craft.app.request.segments|first == 'projects' %}
   // load scripts
  {% endif %}
  </code></pre>
  <p>This works.</p>
  <p>However, I also have pages with the Url <code>/projects/project-name</code> which should not load the script.</p>
  <p>How can you perform a conditional test for just the Url <code>/projects/</code> ?</p>
  <p>Thanks</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-04T07:58:27.283Z
Comments.Text: `{% if craft.app.request.segments|last == 'projects' %}` did the trick
Comments.UserDisplayName: David Flindall
Tags: <url><conditional>
Title: Conditional for specific page
ThreadText: # Conditional for specific page
  
  (Asked by: username_0 on 2020-07-03)
  
  I'd like to only load some scripts for 1 specific page with the Url `/projects/`.
  
  Currently I'm using:
  
  ```
  {% if craft.app.request.segments|first == 'projects' %}
   // load scripts
  {% endif %}
  
  ```
  
  This works.
  
  However, I also have pages with the Url `/projects/project-name` which should not load the script.
  
  How can you perform a conditional test for just the Url `/projects/` ?
  
  Thanks
  
  **Tags:** url, conditional
  
  > **Comments:**
  > **username_0**: `{% if craft.app.request.segments|last == 'projects' %}` did the trick  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-07-04. Score: 2 | Accepted answer
  
  You could use either  `| last` filter instead of first or, a combination of first and another conditional ( segments[1] is empty or similar)?
  
  ```
  {% set segments = craft.app.request.segments %}
  {% if segments | first == “projects” and segments[1] is empty %}
  Load scripts
  {% endif %}
  
  ```
  
  On phone so ymmv
  
  > **Comments:**
  > **username_1**: You might also be able to just test craft.app.request.uri or something (path?) check the request docs?  
  
  ---
  
  ### Answer by username_2 on 2020-07-04. Score: 1
  
  You might check if `projects` is part of URL:
  
  ```
  {% if 'projects' in craft.app.request.segments|split('/') %}
  Load scripts
  {% endif %}
  
  ```
  
  
  ---
  
  