Meta title for 3rd party app

41 views
Skip to first unread message

vvv...@gmail.com

unread,
Mar 27, 2013, 7:46:48 AM3/27/13
to django-...@googlegroups.com
Hello!
I'm have news app integrated with FeinCMS and i cant' figure out how to set meta title when displaying news entry.
Instead of news title like '27.03 - Google anounced new service...' I get 'News' (name of the app).
here's how i render title in base.html:
    <title>{{ feincms_page.title }}</title>

Please help! Couldn't find solution in documentation or in this group.
Thanks.

Martin J. Laubach

unread,
Mar 27, 2013, 11:51:34 AM3/27/13
to django-...@googlegroups.com
  The easiest way to do that is using fragments. I'm afraid the documentation doesn't mention them:

  Put this in you page template:

      <title>{% get_fragment request "frag_title" %}</title>

  and this in your application's template

      {% fragment request "frag_title" %} my title {% endfragment %}

  That should do the job.

vvv...@gmail.com

unread,
Apr 3, 2013, 7:54:35 AM4/3/13
to django-...@googlegroups.com
Thank you Martin! Your solution worked for me.
But I edited it a litte bit for my needs so it will work with FeinCMS page modules.
If someone searches for similar problem, here is how I made it:
3rd app template:
{% fragment request "
title" %} my title {% endfragment %}

base.html:
{% if request|has_fragment:"title" %}
<title>{% get_fragment request "title" %}</title>
{% else %}
<title>{{ feincms_page.title }}</title>
{% endif %}
Reply all
Reply to author
Forward
0 new messages