From 0eb83ba69519d6693281e441da1e7a0408a231d3 Mon Sep 17 00:00:00 2001 From: Zhiming Wang <zmwangx@gmail.com> Date: Sun, 24 Jul 2016 20:05:18 +0800 Subject: pyblog: Handle custom domain Change BLOG_HOME and add CNAME file with custom domain to the build dir. --- pyblog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pyblog') 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) -- cgit v1.2.1