title: Getting current url from a collection in Jekyll
body: <p>If I want to get a page's url it's not exactly complicated:</p>
  
  <pre><code>page.url
  </code></pre>
  
  <p>However, what if I make a collection who's job it is to be used like an include instead of like a page?</p>
  
  <p>If I make such a collection and ask for <code>page.url</code> it gives me the path to the collection instead of the path to the current url.</p>
  
  <p>Is there a way to get the <em>real</em> current URL in Jekyll?</p>
  
  <p><strong>Edit:</strong> example</p>
  
  <hr>
  
  <p>test.md:</p>
  
  <pre><code>---
  title: Test page
  permalink: /test/
  ---
  
  Test page
  
  {% for block in site.blocks %}
      {% if block.whatever %}
          {{ block.content }}
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <hr>
  
  <p>_blocks/block.md:</p>
  
  <pre><code>---
  whatever: true
  ---
  
  {% page.relative_path %}
  </code></pre>
  
  <hr>
  
  <p>Got:</p>
  
  <pre><code>Test page
  
  /_blocks/block.md
  </code></pre>
  
  <hr>
  
  <p>Expected:</p>
  
  <pre><code>Test page
  
  test.md
  </code></pre>