Skip to content
Permalink
Browse files

Default to PRETTY_URLS in the wizard (#1838 1/2)

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information...
Kwpolska committed Jun 21, 2015
1 parent dcd17cb commit 9d6625bafefcda1450d81d34c3a9ad270394f43e
Showing with 14 additions and 5 deletions.
  1. +2 −0 CHANGES.txt
  2. +4 −4 nikola/conf.py.in
  3. +8 −1 nikola/plugins/command/init.py
@@ -4,6 +4,8 @@ New in master
Features
--------

* Enable ``PRETTY_URLS`` by default on new sites created by the wizard
(Issue #1838)
* Add ``-F``, ``--available-compilers`` option to ``nikola new_post``
and ``nikola new_page`` (Issue #1837)
* Add print CSS to all default themes (Issue #1817)
@@ -672,12 +672,12 @@ COMMENT_SYSTEM_ID = ${COMMENT_SYSTEM_ID}
# /robots.txt and /sitemap.xml, and to inform search engines about /sitemapindex.xml.
# ROBOTS_EXCLUSIONS = ["/archive.html", "/category/*.html"]

# Instead of putting files in <slug>.html, put them in
# <slug>/index.html. Also enables STRIP_INDEXES
# Instead of putting files in <slug>.html, put them in <slug>/index.html.
# No web server configuration is required. Also enables STRIP_INDEXES.
# This can be disabled on a per-page/post basis by adding
# .. pretty_url: False
# to the metadata
# PRETTY_URLS = False
# to the metadata.
PRETTY_URLS = ${PRETTY_URLS}

# If True, publish future dated posts right away instead of scheduling them.
# Defaults to False.
@@ -53,6 +53,7 @@
'SITE_URL': "https://example.com/",
'BLOG_EMAIL': "joe@demo.site",
'BLOG_DESCRIPTION': "This is a demo site for Nikola.",
'PRETTY_URLS': False,
'DEFAULT_LANG': "en",
'TRANSLATIONS': """{
DEFAULT_LANG: "",
@@ -199,10 +200,12 @@ def prepare_config(config):
"""Parse sample config with JSON."""
p = config.copy()
p.update(dict((k, json.dumps(v, ensure_ascii=False)) for k, v in p.items()
if k not in ('POSTS', 'PAGES', 'COMPILERS', 'TRANSLATIONS', 'NAVIGATION_LINKS', '_SUPPORTED_LANGUAGES', '_SUPPORTED_COMMENT_SYSTEMS', 'INDEX_READ_MORE_LINK', 'RSS_READ_MORE_LINK')))
if k not in ('POSTS', 'PAGES', 'COMPILERS', 'TRANSLATIONS', 'NAVIGATION_LINKS', '_SUPPORTED_LANGUAGES', '_SUPPORTED_COMMENT_SYSTEMS', 'INDEX_READ_MORE_LINK', 'RSS_READ_MORE_LINK', 'PRETTY_URLS')))
# READ_MORE_LINKs require some special treatment.
p['INDEX_READ_MORE_LINK'] = "'" + p['INDEX_READ_MORE_LINK'].replace("'", "\\'") + "'"
p['RSS_READ_MORE_LINK'] = "'" + p['RSS_READ_MORE_LINK'].replace("'", "\\'") + "'"
# json would make that `true` instead of `True`
p['PRETTY_URLS'] = str(p['PRETTY_URLS'])
return p


@@ -291,6 +294,9 @@ def urlhandler(default, toconf):

SAMPLE_CONF['SITE_URL'] = answer

def prettyhandler(default, toconf):
SAMPLE_CONF['PRETTY_URLS'] = ask_yesno('Enable pretty URLs (/page/ instead of /page.html) that don’t need web server configuration?', default=True)

def lhandler(default, toconf, show_header=True):
if show_header:
print("We will now ask you to provide the list of languages you want to use.")
@@ -406,6 +412,7 @@ def chandler(default, toconf):
('Site author\'s e-mail', 'n.tesla@example.com', True, 'BLOG_EMAIL'),
('Site description', 'This is a demo site for Nikola.', True, 'BLOG_DESCRIPTION'),
(urlhandler, None, True, True),
(prettyhandler, None, True, True),
('Questions about languages and locales', None, None, None),
(lhandler, None, True, True),
(tzhandler, None, True, True),

0 comments on commit 9d6625b

Please sign in to comment.
You can’t perform that action at this time.