I just want to know how is it possible to use the YAML in the <body>, especially in the <head> of the web page. I can't seem to find any examples on the docs and the web.
For example, if I put the following: --- robots: noindex, nofollow ---
How can I access that 'robots' to be usable in the web page itself. My goal is to put it to the <meta />, like the following: <meta robots="robots" content="${}" />
On Fri, Sep 7, 2012 at 2:09 AM, EJelome <ejel...@gmail.com> wrote:
> Hi everyone, newbie here.
Welcome!
> I just want to know how is it possible to use the YAML in the <body>,
> especially in the <head> of the web page. I can't seem to find any examples
> on the docs and the web.
> For example, if I put the following:
> ---
> robots: noindex, nofollow
> ---
> How can I access that 'robots' to be usable in the web page itself. My goal
> is to put it to the <meta />, like the following:
> <meta robots="robots" content="${}" />
The YAML header data is available for use in templates in the post
namespace. So, with the default templates, you should be able to get
what you want with:
On Friday, September 7, 2012 9:33:49 PM UTC+8, Doug Latornell wrote:
> On Fri, Sep 7, 2012 at 2:09 AM, EJelome <eje...@gmail.com <javascript:>> > wrote: > > Hi everyone, newbie here.
> Welcome!
> > I just want to know how is it possible to use the YAML in the <body>, > > especially in the <head> of the web page. I can't seem to find any > examples > > on the docs and the web.
> > For example, if I put the following: > > --- > > robots: noindex, nofollow > > ---
> > How can I access that 'robots' to be usable in the web page itself. My > goal > > is to put it to the <meta />, like the following: > > <meta robots="robots" content="${}" />
> The YAML header data is available for use in templates in the post > namespace. So, with the default templates, you should be able to get > what you want with:
> Traceback (most recent call last): > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/template.py", > line 157, in render > rendered = self.mako_template.render(**self) > File "/usr/local/lib/python2.7/dist-packages/mako/template.py", line > 412, in render > return runtime._render(self, self.callable_, args, data) > File "/usr/local/lib/python2.7/dist-packages/mako/runtime.py", line 766, > in _render > **_kwargs_for_callable(callable_, data)) > File "/usr/local/lib/python2.7/dist-packages/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/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 > <meta name="robots" content="${post.robots}" /> > File > "/usr/local/lib/python2.7/dist-packages/blogofile_blog-0.8-py2.7.egg/blogof ile_blog/site_src/_controllers/blog/post.py", > line 291, in __getattr__ > raise AttributeError(name) > AttributeError: robots
> ERROR:blogofile:Fatal build error occured, calling > bf.config.build_exception() > Traceback (most recent call last): > File "/usr/local/bin/blogofile", line 9, in <module> > load_entry_point('Blogofile==0.8-DEV', 'console_scripts', > 'blogofile')() > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/main.py", > line 58, in main > args.func(args) > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/main.py", > line 388, in do_build > writer.write_site() > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/writer.py", > line 49, in write_site > self.__run_controllers() > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/writer.py", > line 162, in __run_controllers > controller.run_all(namespaces) > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/controller.py", > line 229, in run_all > c.mod.run() > File > "/usr/local/lib/python2.7/dist-packages/blogofile_blog-0.8-py2.7.egg/blogof ile_blog/site_src/_controllers/blog/__init__.py", > line 80, in run > permapage.run() > File > "/usr/local/lib/python2.7/dist-packages/blogofile_blog-0.8-py2.7.egg/blogof ile_blog/site_src/_controllers/blog/permapage.py", > line 12, in run > write_permapages() > File > "/usr/local/lib/python2.7/dist-packages/blogofile_blog-0.8-py2.7.egg/blogof ile_blog/site_src/_controllers/blog/permapage.py", > line 38, in write_permapages > "permapage.mako", bf.util.path_join(path, "index.html"), env) > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/plugin.py", > line 135, in materialize_template > lookup=lookup, caller=self.module) > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/template.py", > line 388, in materialize_template > template.render(location) > File > "/usr/local/lib/python2.7/dist-packages/Blogofile-0.8_DEV-py2.7.egg/blogofi le/template.py", > line 157, in render > rendered = self.mako_template.render(**self) > File "/usr/local/lib/python2.7/dist-packages/mako/template.py", line > 412, in render > return runtime._render(self, self.callable_, args, data) > File "/usr/local/lib/python2.7/dist-packages/mako/runtime.py", line 766, > in _render > **_kwargs_for_callable(callable_, data)) > File "/usr/local/lib/python2.7/dist-packages/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/runtime.py", line 824, > in _exec_template > callable_(context, *args, **kwargs) > File "base_mako", line 23, in render_body > File "site_mako", line 36, in render_body > File > "/usr/local/lib/python2.7/dist-packages/blogofile_blog-0.8-py2.7.egg/blogof ile_blog/site_src/_controllers/blog/post.py", > line 291, in __getattr__ > raise AttributeError(name) > AttributeError: robots
I think I have to declare the keyword 'robots' somewhere (correct me if I'm wrong) so the compiler will know that it exist, only that I don't know where should I put it.