Answers.Body: <p>I think there is just some confusion between what should be a string or not. From the docs on <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax" rel="nofollow">Parameter Value Syntax</a>:</p>
  
  <blockquote>
    <p>To exclude entries with a given value, you must pass in a string, prefixed with not</p>
  </blockquote>
  
  <p>To that end the following should work for your example:</p>
  
  <pre><code>{% for entry in craft.entries.section('news').slug('not ' ~ craft.request.getSegment(2)).limit(6) %}...
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-09T13:23:21.483Z
Answers.Text: Glad I could help :)
Answers.UserDisplayName: Josh Angell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-09T12:48:23.070Z
Answers.LastActivityDate: 2014-10-09T12:48:23.070Z
Answers.UserDisplayName: Josh Angell
Body: <p>I want to return entries in the news section, except the one that has a slug the matches url segment 2.</p>
  
  <p>I've tried:</p>
  
  <pre><code>{% for entry in craft.entries.section('news').slug(not craft.request.getSegment(2)).limit(6) %}...
  {% for entry in craft.entries.section('news').slug('and, not craft.request.getSegment(2)').limit(6) %}...
  </code></pre>
  
  <p>But neither work - <em>all</em> entries are returned.</p>
  
  <p>What's the right syntax please?</p>
  
Tags: <entries><slug>
Title: How to filter entries by slug in url segment?
ThreadText: # How to filter entries by slug in url segment?
  
  (Asked by: username_0 on 2014-10-09)
  
  I want to return entries in the news section, except the one that has a slug the matches url segment 2.
  
  I've tried:
  
  ```
  {% for entry in craft.entries.section('news').slug(not craft.request.getSegment(2)).limit(6) %}...
  {% for entry in craft.entries.section('news').slug('and, not craft.request.getSegment(2)').limit(6) %}...
  
  ```
  
  But neither work - *all* entries are returned.
  
  What's the right syntax please?
  
  **Tags:** entries, slug
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-09. Score: 3 | Accepted answer
  
  I think there is just some confusion between what should be a string or not. From the docs on [Parameter Value Syntax](http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax):
  
  > To exclude entries with a given value, you must pass in a string, prefixed with not
  
  To that end the following should work for your example:
  
  ```
  {% for entry in craft.entries.section('news').slug('not ' ~ craft.request.getSegment(2)).limit(6) %}...
  
  ```
  
  > **Comments:**
  > **username_1**: Glad I could help :)  
  
  ---
  
  