aboutsummaryrefslogtreecommitdiff
path: root/pyblog
diff options
context:
space:
mode:
authorZhiming Wang <zmwangx@gmail.com>2016-07-24 20:05:18 +0800
committerZhiming Wang <zmwangx@gmail.com>2016-07-24 20:05:18 +0800
commit0eb83ba69519d6693281e441da1e7a0408a231d3 (patch)
treef7f96d75b7af5aea94ddae8ef38a10c769fff74e /pyblog
parent4151a170e991fa73b8b52111bf88508a99c57da1 (diff)
downloadmy_new_personal_website-0eb83ba69519d6693281e441da1e7a0408a231d3.tar.xz
my_new_personal_website-0eb83ba69519d6693281e441da1e7a0408a231d3.zip
pyblog: Handle custom domain
Change BLOG_HOME and add CNAME file with custom domain to the build dir.
Diffstat (limited to 'pyblog')
-rwxr-xr-xpyblog7
1 files changed, 6 insertions, 1 deletions
diff --git a/pyblog b/pyblog
index 9e6f09a5..d81657ec 100755
--- a/pyblog
+++ b/pyblog
@@ -39,7 +39,8 @@ import lxml.etree as ET
############################# BLOG CONFIGURATIONS ##############################
# Safe to customize
-BLOG_HOME = "http://zmwangx.github.io/"
+BLOG_HOME = "http://zhimingwang.org/"
+CUSTOM_DOMAIN = "zhimingwang.org" # GitHub Pages custom domain (could be None)
BLOG_TITLE = "dl? cmplnts?"
BLOG_DESCRIPTION = "Zhiming Wang's personal blog"
LANGUAGE = "en-us"
@@ -751,6 +752,10 @@ def generate_blog(fresh=False, report_total_errors=True):
with open(os.path.join(BUILDDIR, ".nojekyll"), "w") as fileobj:
pass
+ if CUSTOM_DOMAIN and not os.path.exists(os.path.join(BUILDDIR, "CNAME")):
+ with open(os.path.join(BUILDDIR, "CNAME"), "w") as fileobj:
+ fileobj.write(CUSTOM_DOMAIN)
+
failed_builds = 0
generator_mtime = os.path.getmtime(GENERATORSOURCE)
template_mtime = os.path.getmtime(HTMLTEMPLATE)