Login

Snippets by nny777

Snippet List

Read more link

I couldn't find any code for a blog-style "Read more after the jump," so I made a custom filter. It will look for **<!--more-->** for the jump, like in Wordpress. In **settings.py** set **READ_MORE_TEXT** to what you want the text of the link to be. `READ_MORE_TEXT = 'Read more after the jump.'` When you call the filter in your template, pass it the absolute link of that entry. Of course, you have to have your **get_absolute_url** function defined in your model, but you should have that already, right? :P In this example **entry.body** is the content of the blog entry. `{% load blog_filters %}` `{{ entry.body|read_more:entry.get_absolute_url }}` If anyone has a better way to do this, it is, of course, welcome.

  • template
  • filter
  • blog
  • find
  • jump
  • read
  • more
Read More

nny777 has posted 1 snippet.