Closed decentral1se closed 10 years ago
I am going to add a +1 on this. I am facing the same difficulty to create a landing/contact page. When adding the following content/landing.md (the example from the docs):
Title: Landing
Heading: Hello! My Name is John Doe
Subheading: Some subheading sentence to put int.
Template: landing
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quidem, quia, modi suscipit deleniti veniam voluptatum corporis neque sit error earum recusandae velit alias unde laudantium explicabo veritatis laboriosam cum totam ipsum voluptatem dicta nemo necessitatibus! Repellat, laudantium, at deserunt velit similique natus quia quisquam ex tempore praesentium inventore quod eos.
This one fails when using make html, on the missing date in the metadata. Adding it made me reach a new fail:
pelican /var/www/isopa/content -o /var/www/isopa/output -s /var/www/isopa/pelicanconf.py
CRITICAL: 'page' is undefined
make: *** [html] Error 1
Well, found it... Using DEBUG mode, here is the stacktrace:
Traceback (most recent call last):
File "/home/marco/.virtualenvs/pelican/bin/pelican", line 9, in <module>
load_entry_point('pelican==3.3', 'console_scripts', 'pelican')()
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/__init__.py", line 350, in main
pelican.run()
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/__init__.py", line 181, in run
p.generate_output(writer)
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/generators.py", line 475, in generate_output
self.generate_pages(writer)
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/generators.py", line 369, in generate_pages
self.generate_articles(write)
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/generators.py", line 263, in generate_articles
override_output=hasattr(article, 'override_save_as'))
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/writers.py", line 211, in write_file
override_output)
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/writers.py", line 148, in _write_file
output = template.render(localcontext)
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/themes/pelican-cait/templates/landing.html", line 1, in top-level template code
{% extends "base.html" %}
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/themes/pelican-cait/templates/base.html", line 34, in top-level template code
{% block content %}
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/themes/pelican-cait/templates/landing.html", line 11, in block "content"
<h1>{{ page.heading }}</h1>
File "/home/marco/.virtualenvs/pelican/local/lib/python2.7/site-packages/jinja2/environment.py", line 397, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'page' is undefined
And in ~/pelican-themes/pelican-cait/templates/landing.html, I read this:
<header id="intro-header">
<h1>{{ page.heading }}</h1>
<h2>{{ page.subheading}}</h2>
</header>
Which made me guess, the landing.md, mentioned earlier. has to go to content/pages. And boum, it works.
I have set a PR to emphasize its location, should that be necessary to anyone else, but me.
Thanks
hey, turns out that your current working blog is a perfect reference for getting a working site : https://github.com/hdra/hndr.me
Those files needs to go to your static pages directory, which is defined in your pelican config file. I updated the doc to clarify this a little bit more.
cool!
motiteux, you have made my day :)
Thanks @motiteux, you save me the debug time, you rock!
The README isn't quite clear as to how to get the landing / contact page working. What needs to be done exactly?
A landing.md, contact.md with the Title, Heading. Subheading, etc... in content/ ??