title: Django template tags within a hyperlink
body: <p>In my .html file, I have this code:</p>
  
  <pre><code>&lt;ul&gt;
      {% for file in files %}
          &lt;li&gt;&lt;a href="{% static 'notebooks/&lt;**Part that I want to reference dynamically**&gt;' %}"&gt;{{ file }}&lt;/a&gt;&lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>In my views.py file:</p>
  
  <pre><code>def ipythonlist(request):
      files = [] 
  
      main_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'static/'))
      ipython_file_path = os.path.join(main_dir, 'notebooks/')
  
      for file in os.listdir(ipython_file_path):
          if file.endswith(".html"):
              files.append(file)
  
      return render(request, 'pages/ipythonlist.html', {'files': files})
  </code></pre>
  
  <p>And my url file:</p>
  
  <pre><code>url(r'^ipython/list', views.ipythonlist, name='ipythonlist')
  </code></pre>
  
  <p>So what I am trying to do is get a list of all the .html files (or any type of files for that matter, pdf, csv, etc.) within a directory in my static folder. Then I pass this data from the views into my html using template tags. I want to link to that corresponding file dynamically, but I am not sure how to do that.</p>
  
  <p>I tried {% static 'notebooks/{{file}}' %}, but that just returned an error. </p>
  
  <p>Not sure how to do this and would appreciate some help!</p>
  
  <p>So an example of the link to a file would be {% static 'notebooks/chapter9.pdf' %}. Where chapter9, can be any name.</p>