how to exchange "blog-post-full-text-version" into "blog-post-excerpt" in the index-file of categories

26 views
Skip to first unread message

Tobias

unread,
Jul 19, 2011, 1:45:25 PM7/19/11
to blogofil...@googlegroups.com
Hi at all, 

first thanks to you for programming and supporting blogofile. In wich way its possible to change the category-index-handling. I wish to show in the categorie-index-files only an excerpt and not the full text of an blog-post. I would be pleased, if one of you could give me a hint/tip, to change this.

Thanks for help, 

Tobias

Peter Zsoldos

unread,
Jul 20, 2011, 4:08:14 PM7/20/11
to blogofil...@googlegroups.com
Tobias,

I have not yet tried this, but AFAIK (I've been using blogofile (0.8-dev) for about a month) it's not possible without changing the internals. My approach would be to create a new template (by default, it'd only inherit from chronological.mako), and change the categories.py file to pass the newly created template name to the materialize_template call.

Please let me know whether the above makes sense, and if you try it out, let us know whether it worked!

HTH,

Peter

Ryan McGuire

unread,
Jul 20, 2011, 8:15:52 PM7/20/11
to blogofil...@googlegroups.com
I admit this is bit hacky, but here's a way you could do what you want without modifying the internals:

In your chronological.py:

replace:
<%include file="post.mako" args="post=post" />

with:
  % if bf.template_context.render_path.startswith("/blog/category"):
    <%include file="post_excerpt.mako" args="post=post" />
  % else:
    <%include file="post.mako" args="post=post" />
  % endif

That is just including a different post template depending on the URL being rendered, in this case the category pages.

--
You received this message because you are subscribed to the Google Groups "blogofile-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/blogofile-discuss/-/EFi4TMtBEQ0J.

To post to this group, send email to blogofil...@googlegroups.com.
To unsubscribe from this group, send email to blogofile-disc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/blogofile-discuss?hl=en.

Ryan McGuire

unread,
Jul 20, 2011, 8:18:55 PM7/20/11
to blogofile-discuss
Of course that would be chronological.mako not chronological.py

And if you're using the latest git, you would need to instantiate
those templates by running:

blogofile blog templates copy _templates/blog

and then follow the directions spit out on your screen for using the
copied templates.

On Jul 20, 8:15 pm, Ryan McGuire <tellar...@gmail.com> wrote:
> I admit this is bit hacky, but here's a way you could do what you want
> without modifying the internals:
>
> In your chronological.py:
>
> replace:
> <%include file="post.mako" args="post=post" />
>
> with:
>   % if bf.template_context.render_path.startswith("/blog/category"):
>     <%include file="post_excerpt.mako" args="post=post" />
>   % else:
>     <%include file="post.mako" args="post=post" />
>   % endif
>
> That is just including a different post template depending on the URL being
> rendered, in this case the category pages.
>
Reply all
Reply to author
Forward
0 new messages