Closed Jenselme closed 10 years ago
Hi @Jenselme,
The meta-data keys need to be capitalised, so it's Slug
instead of slug
. See this example:
Test AsciiDoc File Header
=========================
:Author: Author O. Article
:Email: <author@nowhere.com>
:Date: 2011-09-15 09:05
:Category: Blog
:Tags: Linux, Python, Pelican
Used for pelican test
---------------------
The quick brown fox jumped over the lazy dog's back.
Seems I'm having the same issue. @kylef I tried your suggestion but my generated about page is called About-None.html
. Any ideas?
@royemmerich post full config and the page you want to parse which gets named About-None.html
Thanks @ingwinlu. Here is my pelicanconf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Roy Martin Emmerich'
SITENAME = u'Infinite Fingers'
SITEURL = 'http://localhost:8000'
TIMEZONE = 'Europe/Berlin'
DEFAULT_LANG = u'en'
LOCALE = ('en_GB')
DATE_FORMATS = {
'en': '%d %b %Y',
}
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
DELETE_OUTPUT_DIRECTORY = True
# Blogroll
LINKS = False
# Social widget
SOCIAL = (('LinkedIn', 'http://www.linkedin.com/in/royemmerich'),)
# Uncomment following line if you want document-relative URLs when developing
RELATIVE_URLS = True
THEME = 'themes/cait'
OUTPUT_PATH = 'output/'
PATH = 'content/'
ARTICLE_EXCLUDES = ('pages',)
ARTICLE_DIR = 'blog/'
ARTICLE_URL = 'blog/{slug}/'
ARTICLE_SAVE_AS = 'blog/{slug}/index.html'
PAGE_DIR = 'pages/'
PAGE_URL = '{slug}/'
PAGE_SAVE_AS = '{slug}/index.html'
PAGE_URL = '{slug}.html'
PAGE_SAVE_AS = '{slug}.html'
DIRECT_TEMPLATES = (('index', 'tags', 'categories', 'archives',))
DEFAULT_PAGINATION = 2
NEWEST_FIRST_ARCHIVES = False
PAGINATED_DIRECT_TEMPLATES = (('index', 'tags', 'categories', 'archives',))
and here is my About.asc
file:
About
=====
:Author: Roy Martin Emmerich
:Email: <roy.emmerich@infinitefingers.com>
:Date: 2014-06-16 00:50
:Category: About
:Tags: About
:Slug: About
About Infinite Fingers
----------------------
image:../images/roy-300x348.jpg[]
What also doesn't seem to be working is saving the generated PAGES into {slug}/index.html
. An output/pages
folder is still being generated and the html pages are saved in there (e.g. About-None.html
).
@royemmerich, you defined PAGE_URL
and PAGE_SAVE_AS
twice:
PAGE_URL = '{slug}/'
PAGE_SAVE_AS = '{slug}/index.html'
PAGE_URL = '{slug}.html'
PAGE_SAVE_AS = '{slug}.html'
So, the last one is active and you should get About.html
, not About/index.html
.
Regarding, output/pages/About-None.html
: That looks like a translation that is formatted according to PAGE_LANG_URL
and PAGE_LANG_SAVE_AS
. Default for them is 'pages/{slug}-{lang}.html'
. Check if you have more than one page with same slug (About
in this case?). However, I don't know why you would get None
for lang
. It should default to DEFAULT_LANG
.
@avaris thanks for spotting the duplication. I had just spent too much time experimenting with all the basic settings :smile: However it seems either way produces the same output namely: output/pages/About-None.html
I did notice, when running make html
from my site's root directory, with a LOCALE
setting of en_US
that I was getting the following error:
WARNING: LOCALE option doesn't contain a correct value
So I used locale -a
from the Linux command prompt to find all the available locales on my machine:
$ locale -a
...
en_US.utf8
de_DE.utf8
...
and changed it to a valid one (en_US.utf8
). The results were the same. :frowning: I then ran locale
from the Linux command prompt to see what my current settings are:
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
Notice that the values of some locale variables are enclosed in inverted commas ("). I also tried the following from within a python prompt:
>>> import os
>>> os.getenv('LANG')
'en_US.UTF-8'
>>> os.getenv('LC_CTYPE')
>>> os.getenv('LC_NUMERIC')
'de_DE.UTF-8'
Notice that only locale variables not surrounded in inverted commas produced a result within the python environment. So which one is valid from within the Pelican environment, en_US.utf8
or en_US.UTF-8
?
I tried both options in my pelicanconf.py
file:
DEFAULT_LANG = u'en_US.UTF-8'
LOCALE = ('en_US.UTF-8')
DATE_FORMATS = {
'en_US.UTF-8': '%a %d %b %Y',
}
PAGE_URL = '{slug}.html'
PAGE_SAVE_AS = '{slug}.html'
PAGE_LANG_URL = '{slug}/'
PAGE_LANG_SAVE_AS = '{slug}/index.html'
and
DEFAULT_LANG = u'en_US.utf8'
LOCALE = ('en_US.utf8')
DATE_FORMATS = {
'en_US.utf8': '%a %d %b %Y',
}
PAGE_URL = '{slug}.html'
PAGE_SAVE_AS = '{slug}.html'
PAGE_LANG_URL = '{slug}/'
PAGE_LANG_SAVE_AS = '{slug}/index.html'
Neither of these language options obey the PAGE_URL
and PAGE_SAVE_AS
settings listed above. Clearly python thinks my default language is not en_US.utf8
or en_US.UTF-8
.
So at the moment my solution is just to make the PAGE_*
and PAGE_LANG_*
options the same.
Thanks for the super support! :thumbsup:
I played around a bit more and discovered if I change the LOCALE
setting from en_US.utf8
to de_DE.utf8
then the day abbreviations change (e.g. Tue
for US
and Di
for DE
).
After checking out the DATE_FORMAT documentation I changed my pelicanconf.py
file as follows:
LOCALE = ('en_US.utf8')
DATE_FORMATS = {
'en_US.utf8': ('de_DE.utf8','%a %d %b %Y'),
}
but the date day names, represented by %a
in the format string, stubbornly remain in their English form despite the documentation promising otherwise. :confused:
Hi,
I tried to wrote some articles using the Asciidoc markup but the generated are not named correctly. I let all the options by default, 'None' is added to the filename. By example, if
:slug: toto
the file is name toto-None.html.Moreover, if I change the URL format:
The file still have the same URL. But if I use Markdown or Rest, everything is fine. An idea on what the problem might be?
Here is my article content, saved in posts/page3.asc: