Skip to content

Commit

Permalink
set default URL to https://example.com/
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 4, 2015
1 parent 72b050a commit c3c13ac
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion nikola/nikola.py
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/command/init.py
Expand Up @@ -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",
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/data/translated_titles/conf.py
Expand Up @@ -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/"
Expand Down
30 changes: 15 additions & 15 deletions tests/test_integration.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand All @@ -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):
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit c3c13ac

Please sign in to comment.