diff options
author | Zhiming Wang <zmwangx@gmail.com> | 2016-07-24 20:05:18 +0800 |
---|---|---|
committer | Zhiming Wang <zmwangx@gmail.com> | 2016-07-24 20:05:18 +0800 |
commit | 0eb83ba69519d6693281e441da1e7a0408a231d3 (patch) | |
tree | f7f96d75b7af5aea94ddae8ef38a10c769fff74e /pyblog | |
parent | 4151a170e991fa73b8b52111bf88508a99c57da1 (diff) | |
download | my_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 '')
-rwxr-xr-x | pyblog | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) |