How to get blog post title in HTML title tag

50 views
Skip to first unread message

PESTLEWeb England

unread,
Apr 13, 2013, 10:06:56 AM4/13/13
to blogofil...@googlegroups.com
Guys,

I am really pleased with Blogofile. I feel it is giving me really good results that I am very happy with (See here for example:do-you-know-judo? ).

So thank you to the developers for that!

I see that the question about getting the blog post title in the HTML title tags has been asked before - but I can't find the answer anywhere.

Could somebody help please?

Thanks

Rob

Doug Latornell

unread,
Apr 13, 2013, 2:44:02 PM4/13/13
to blogofil...@googlegroups.com
On Sat, Apr 13, 2013 at 4:06 PM, PESTLEWeb England <pest...@gmail.com> wrote:
Guys,

I am really pleased with Blogofile. I feel it is giving me really good results that I am very happy with (See here for example:do-you-know-judo? ).

Glad it's working out well for you. Nice post.
 

So thank you to the developers for that!

Thanks for the thanks!
 

I see that the question about getting the blog post title in the HTML title tags has been asked before - but I can't find the answer anywhere.

Could somebody help please?

I haven't tested this, but off the top of my head I'd say that you need to modify _templates/head.mako. What happens if you replace <title>${bf.config.blog.name}</title> with <title>${post.title}</title>?
 

Thanks

Rob

--
You received this message because you are subscribed to the Google Groups "blogofile-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blogofile-disc...@googlegroups.com.
To post to this group, send email to blogofil...@googlegroups.com.
Visit this group at http://groups.google.com/group/blogofile-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

PESTLEWeb England

unread,
Apr 14, 2013, 1:47:01 PM4/14/13
to blogofil...@googlegroups.com, d...@douglatornell.ca
Sorry - that gives the error string below (several times - I have only copied it here once.

I checked - and all of my posts do have a "title: xxxx" in the identification section at the top. Something like this...

---
categories: 12 elements, Goal, Value, Impact
date: 2013/3/15 15:22:00
title: 12 Elements that Ensure it-will-happen
---

Rob


ERROR:blogofile.template:Error rendering template: chronological.mako

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8b1-py2.7.egg/blogofile/template.py", line 154, in render
    rendered = self.mako_template.render(**self)
  File "/usr/local/lib/python2.7/dist-packages/Mako-0.7.2-py2.7.egg/mako/template.py", line 412, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/local/lib/python2.7/dist-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 766, in _render
    **_kwargs_for_callable(callable_, data))
  File "/usr/local/lib/python2.7/dist-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 798, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/local/lib/python2.7/dist-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 824, in _exec_template
    callable_(context, *args, **kwargs)
  File "_templates/base.mako", line 2, in render_body
    ${next.body()}
  File "_templates/site.mako", line 12, in render_body
    ${self.head()}
  File "_templates/site.mako", line 33, in render_head
    <%def name="head()"><%include file="head.mako" /></%def>
  File "/usr/local/lib/python2.7/dist-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 693, in _include_file
    callable_(ctx, **_kwargs_for_include(callable_, context._data, **kwargs))
  File "_templates/head.mako", line 1, in render_body
    <title>${post.title}</title>
AttributeError: 'Undefined' object has no attribute 'title'


Mike Pirnat

unread,
Apr 14, 2013, 4:16:00 PM4/14/13
to blogofil...@googlegroups.com, d...@douglatornell.ca
This is bombing because it's trying to render a non-post page and
doesn't know about posts. Same thing happened to me. Here's what I
put in my head.mako:

% if post is not UNDEFINED:
<title>${bf.config.blog.name}: ${post.title}</title>
% elif category is not UNDEFINED:
<title>${bf.config.blog.name}: ${category}</title>
% else:
<title>${bf.config.blog.name}</title>
% endif

This way I can use the same head.mako across my site.
> --
> You received this message because you are subscribed to the Google Groups
> "blogofile-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to blogofile-disc...@googlegroups.com.
> To post to this group, send email to blogofil...@googlegroups.com.
> Visit this group at http://groups.google.com/group/blogofile-discuss?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Mike Pirnat
mpi...@gmail.com
http://mike.pirnat.com/

PESTLEWeb England

unread,
Apr 15, 2013, 11:39:00 AM4/15/13
to blogofil...@googlegroups.com, d...@douglatornell.ca
Mike,

Thank you! Worked perfectly!

I think I like blogofile more and more....I was half expecting this to be a difficult fix. However, once explained it is relatively easy. (They do say that 'experience' is that thing which you have just after you needed it!! )

Rob
Reply all
Reply to author
Forward
0 new messages