Skip to content
Permalink
Browse files
Merge pull request #1685 from getnikola/example.com
Set default URL to https://example.com/
  • Loading branch information
Kwpolska committed May 4, 2015
2 parents 72b050a + c3c13ac commit c231f1721d80599d8fc342826c22a9e6a289f77e
Showing with 20 additions and 19 deletions.
  1. +1 −0 CHANGES.txt
  2. +1 −1 nikola/nikola.py
  3. +2 −2 nikola/plugins/command/init.py
  4. +1 −1 tests/data/translated_titles/conf.py
  5. +15 −15 tests/test_integration.py
@@ -4,6 +4,7 @@ New in master
Features
--------

* Set default new site URL to https://example.com/
* Plugins can manipulate task dependencies (Issue #1679)
* LINK_CHECK_WHITELIST now works with output relative and full fs paths
* Four new filters: html_tidy_nowrap, html_tidy_wrap, html_tidy_wrap_attr,
@@ -409,7 +409,7 @@ def __init__(self, **config):
'SHOW_UNTRANSLATED_POSTS': True,
'SLUG_TAG_PATH': True,
'SOCIAL_BUTTONS_CODE': '',
'SITE_URL': 'http://getnikola.com/',
'SITE_URL': 'https://example.com/',
'STORY_INDEX': False,
'STRIP_INDEXES': False,
'SITEMAP_INCLUDE_FILELESS_DIRS': True,
@@ -50,7 +50,7 @@
SAMPLE_CONF = {
'BLOG_AUTHOR': "Your Name",
'BLOG_TITLE': "Demo Site",
'SITE_URL': "http://getnikola.com/",
'SITE_URL': "https://example.com/",
'BLOG_EMAIL': "joe@demo.site",
'BLOG_DESCRIPTION': "This is a demo site for Nikola.",
'DEFAULT_LANG': "en",
@@ -262,7 +262,7 @@ def create_empty_site(cls, target):
def ask_questions(target):
"""Ask some questions about Nikola."""
def urlhandler(default, toconf):
answer = ask('Site URL', 'http://getnikola.com/')
answer = ask('Site URL', 'https://example.com/')
try:
answer = answer.decode('utf-8')
except (AttributeError, UnicodeDecodeError):
@@ -23,7 +23,7 @@
BLOG_TITLE = "Demo Site" # (translatable)
# This is the main URL for your site. It will be used
# in a prominent link
SITE_URL = "http://getnikola.com/"
SITE_URL = "https://example.com/"
# This is the URL where nikola's output will be deployed.
# If not set, defaults to SITE_URL
# BASE_URL = "http://getnikola.com/"
@@ -116,12 +116,12 @@ def fill_site(self):
def test_index_in_sitemap(self):
sitemap_path = os.path.join(self.target_dir, "output", "sitemap.xml")
sitemap_data = io.open(sitemap_path, "r", encoding="utf8").read()
self.assertTrue('<loc>http://getnikola.com/index.html</loc>' in sitemap_data)
self.assertTrue('<loc>https://example.com/index.html</loc>' in sitemap_data)

def test_avoid_double_slash_in_rss(self):
rss_path = os.path.join(self.target_dir, "output", "rss.xml")
rss_data = io.open(rss_path, "r", encoding="utf8").read()
self.assertFalse('http://getnikola.com//' in rss_data)
self.assertFalse('https://example.com//' in rss_data)


class RepeatedPostsSetting(DemoBuildTest):
@@ -272,8 +272,8 @@ def patch_site(self):
conf_path = os.path.join(self.target_dir, "conf.py")
with io.open(conf_path, "r", encoding="utf-8") as inf:
data = inf.read()
data = data.replace('SITE_URL = "http://getnikola.com/"',
'SITE_URL = "http://getnikola.com/foo/bar/"')
data = data.replace('SITE_URL = "https://example.com/"',
'SITE_URL = "https://example.com/foo/bar/"')
with io.open(conf_path, "w+", encoding="utf8") as outf:
outf.write(data)

@@ -295,8 +295,8 @@ def test_index_in_sitemap(self):
"""Test that the correct path is in sitemap, and not the wrong one."""
sitemap_path = os.path.join(self.target_dir, "output", "sitemap.xml")
sitemap_data = io.open(sitemap_path, "r", encoding="utf8").read()
self.assertFalse('<loc>http://getnikola.com/</loc>' in sitemap_data)
self.assertTrue('<loc>http://getnikola.com/foo/bar/index.html</loc>' in sitemap_data)
self.assertFalse('<loc>https://example.com/</loc>' in sitemap_data)
self.assertTrue('<loc>https://example.com/foo/bar/index.html</loc>' in sitemap_data)


class TestCheck(DemoBuildTest):
@@ -321,16 +321,16 @@ class TestCheckAbsoluteSubFolder(TestCheck):
"""Validate links in a site which is:
* built in URL_TYPE="absolute"
* deployable to a subfolder (BASE_URL="http://demo.getnikola.com/foo/")
* deployable to a subfolder (BASE_URL="https://example.com/foo/")
"""

@classmethod
def patch_site(self):
conf_path = os.path.join(self.target_dir, "conf.py")
with io.open(conf_path, "r", encoding="utf-8") as inf:
data = inf.read()
data = data.replace('SITE_URL = "http://getnikola.com/"',
'SITE_URL = "http://demo.getnikola.com/foo/"')
data = data.replace('SITE_URL = "https://example.com/"',
'SITE_URL = "https://example.com/foo/"')
data = data.replace("# URL_TYPE = 'rel_path'",
"URL_TYPE = 'absolute'")
with io.open(conf_path, "w+", encoding="utf8") as outf:
@@ -341,23 +341,23 @@ def test_index_in_sitemap(self):
"""Test that the correct path is in sitemap, and not the wrong one."""
sitemap_path = os.path.join(self.target_dir, "output", "sitemap.xml")
sitemap_data = io.open(sitemap_path, "r", encoding="utf8").read()
self.assertTrue('<loc>http://demo.getnikola.com/foo/index.html</loc>' in sitemap_data)
self.assertTrue('<loc>https://example.com/foo/index.html</loc>' in sitemap_data)


class TestCheckFullPathSubFolder(TestCheckAbsoluteSubFolder):
"""Validate links in a site which is:
* built in URL_TYPE="full_path"
* deployable to a subfolder (BASE_URL="http://demo.getnikola.com/foo/")
* deployable to a subfolder (BASE_URL="https://example.com/foo/")
"""

@classmethod
def patch_site(self):
conf_path = os.path.join(self.target_dir, "conf.py")
with io.open(conf_path, "r", encoding="utf-8") as inf:
data = inf.read()
data = data.replace('SITE_URL = "http://getnikola.com/"',
'SITE_URL = "http://demo.getnikola.com/foo/"')
data = data.replace('SITE_URL = "https://example.com/"',
'SITE_URL = "https://example.com/foo/"')
data = data.replace("# URL_TYPE = 'rel_path'",
"URL_TYPE = 'full_path'")
with io.open(conf_path, "w+", encoding="utf8") as outf:
@@ -423,8 +423,8 @@ def test_index_in_sitemap(self):
"""Test that the correct path is in sitemap, and not the wrong one."""
sitemap_path = os.path.join(self.target_dir, "output", "sitemap.xml")
sitemap_data = io.open(sitemap_path, "r", encoding="utf8").read()
self.assertFalse('<loc>http://getnikola.com/</loc>' in sitemap_data)
self.assertTrue('<loc>http://getnikola.com/blog/index.html</loc>' in sitemap_data)
self.assertFalse('<loc>https://example.com/</loc>' in sitemap_data)
self.assertTrue('<loc>https://example.com/blog/index.html</loc>' in sitemap_data)


class MonthlyArchiveTest(DemoBuildTest):

0 comments on commit c231f17

Please sign in to comment.