From b035a0a6194b71e2e073efc008edd4670bb6b53c Mon Sep 17 00:00:00 2001 From: "David A. Harding" Date: Fri, 4 Sep 2015 13:08:00 -0400 Subject: [PATCH] Prevent site indexing for preview builds --- README.md | 21 +++++++++++++++++++++ _build/update_txpreview.sh | 3 +++ robots.txt | 11 +++++++++++ 3 files changed, 35 insertions(+) diff --git a/README.md b/README.md index b48c410d..e820ca5a 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,27 @@ run if the API site is running slow. For a list of languages, look in the `_translations` directory. +#### Publishing Previews + +You can publish your previews online to any static hosting service. +[GitHub pages](https://pages.github.com/) is a free service available to +all GitHub users that works with Bitcoin.org's site hierarchy. + +Before building a preview site, it is recommended that you set the +environmental variable `BITCOINORG_BUILD_TYPE` to "preview". This will +enable some content that would otherwise be hidden and also create a +robots.txt file that will help prevent the site from being indexed by +search engines and mistaken for the actual Bitcoin.org website. + +In the bash shell, you can do this by running the following command line +before building you preview: + + export BITCOINORG_BUILD_TYPE=preview + +You can also add this line to your `~/.bashrc` file if you frequently +build site previews so that you don't have to remember to run it for +each shell. + ## Developer Documentation Most parts of the documentation can be found in the [_includes](https://github.com/bitcoin-dot-org/bitcoin.org/tree/master/_includes) diff --git a/_build/update_txpreview.sh b/_build/update_txpreview.sh index 5cec9672..fbd8e6b0 100755 --- a/_build/update_txpreview.sh +++ b/_build/update_txpreview.sh @@ -11,6 +11,9 @@ WORKDIR=`mktemp -d` LIVEDIR=`mktemp -d` SITEDIR='/bitcoin.org/txpreview' DESTDIR='/var/www/txpreview' +BITCOINORG_BUILD_TYPE='preview' + +export BITCOINORG_BUILD_TYPE # Stop script in case a single command fails set -e diff --git a/robots.txt b/robots.txt index 8ee21765..ceaa90d5 100644 --- a/robots.txt +++ b/robots.txt @@ -1 +1,12 @@ +--- +# This file is licensed under the MIT License (MIT) available on +# http://opensource.org/licenses/MIT. + +layout: null +--- +{% if site.env.BITCOINORG_BUILD_TYPE == 'preview' %} +User-agent: * +Disallow: / +{% else %} Sitemap: https://bitcoin.org/sitemap.xml +{% endif %}