Public pages: Linking

  1. Template inheritance
  2. Public pages
  3. If… Then

If you want people to link to your posts, it’s a good idea to provide links. Django can provide the URL of a model’s instance using the {% url %} tag.

In index.html, replace the <h2>{{ post.title }}</h2> headline with:

<h2><a href="{% url postings.views.showPost post.slug %}">{{ post.title }}</a></h2>

This will link each posting’s headline on the main page with that post’s individual page.

  1. Template inheritance
  2. Public pages
  3. If… Then