Change metadata system to fix broken links

The metadata system ('include fields.md') copied over from the user
guide does not appear to work properly on the main website (most likely
due to the newer Jekyll version in use here). This is causing broken
links on the pages that use them - the quickstart guides. This commit
changes to using a Jekyll plugin to provide the metadata which works
more reliably (and is easier-to-understand code than trying to do it in
Liquid template language) and converts the quickstart guide to use this
new metadata. This fixes the broken links on the quickstart guides.

It also renames quickstart/my-web-cluster.yaml to be
_my-web-cluster.yaml to prevent the file being published; it contains
template variable substitutions so it's not suitable for direct use.
diff --git a/_includes/fields.md b/_includes/fields.md
deleted file mode 100644
index c2f2e2d..0000000
--- a/_includes/fields.md
+++ /dev/null
@@ -1,38 +0,0 @@
-{% capture brooklyn_version %}0.7.0-SNAPSHOT{% endcapture %}
-
-{% if brooklyn_version contains 'SNAPSHOT' %}{% capture SNAPSHOT %}true{% endcapture %}{% endif %}
-
-{% capture brooklyn_examples_branch %}{% if SNAPSHOT %}{{ site.brooklyn-snapshot-git-branch }}{% else %}{{ brooklyn_version }}{% endif %}{% endcapture %}
-
-{% capture cloudsoft_snapshots_base_url %}http://developers.cloudsoftcorp.com/maven/snapshots/{% endcapture %}
-{% capture cloudsoft_releases_base_url %}http://developers.cloudsoftcorp.com/maven/releases/{% endcapture %}
-{% capture cloudsoft_this_version_base_url %}http://developers.cloudsoftcorp.com/maven/{% if SNAPSHOT %}snapshots/{% else %}releases/{% endif %}{% endcapture %}
-
-{% capture cloudsoft_this_version_groupid_url %}{{ cloudsoft_this_version_base_url }}io/brooklyn/{% endcapture %}
-{% capture cloudsoft_this_dist_url_dir %}{{ cloudsoft_this_version_groupid_url }}brooklyn-dist/{{ brooklyn_version }}/{% endcapture %}
-{% capture cloudsoft_this_alljar_url_dir %}{{ cloudsoft_this_version_groupid_url }}brooklyn-all/{{ brooklyn_version }}/{% endcapture %}
-
-<!--- both snapshots and releases -->
-{% capture sonatype_repo_groupid_url %}https://oss.sonatype.org/content/groups/public/io/brooklyn/{% endcapture %}
-<!--- releases --> 
-{% capture mavencentral_repo_groupid_url %}http://repo1.maven.org/maven2/io/brooklyn/{% endcapture %}
-
-{% if SNAPSHOT %}
-  {% capture this_anything_url_search %}https://oss.sonatype.org/index.html#nexus-search;gav~io.brooklyn~~{{ brooklyn_version }}~~{% endcapture %}
-  {% capture this_dist_url_search %}https://oss.sonatype.org/index.html#nexus-search;gav~io.brooklyn~brooklyn-dist~{{ brooklyn_version }}~~{% endcapture %}
-  {% capture this_alljar_url_search %}https://oss.sonatype.org/index.html#nexus-search;gav~io.brooklyn~brooklyn-dist~{{ brooklyn_version }}~~{% endcapture %}
-  {% capture this_dist_url_dir %}{{ sonatype_repo_groupid_url }}brooklyn-dist/{{ brooklyn_version }}/{% endcapture %}
-  {% capture this_alljar_url_dir %}{{ sonatype_repo_groupid_url }}brooklyn-all/{{ brooklyn_version }}/{% endcapture %}
-  {% capture this_dist_url_zip %}https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn&v={{ brooklyn_version }}&a=brooklyn-dist&c=dist&e=zip{% endcapture %}
-  {% capture this_dist_url_tgz %}https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn&v={{ brooklyn_version }}&a=brooklyn-dist&c=dist&e=tar.gz{% endcapture %}
-  {% capture this_alljar_url_jar  %}https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn&v={{ brooklyn_version }}&a=brooklyn-all&c=with-dependencies&e=jar{% endcapture %}
-{% else %}<!--- RELEASE -->
-  {% capture this_anything_url_search %}http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.brooklyn%22%20AND%20v%3A%22{{ brooklyn_version }}%22{% endcapture %}
-  {% capture this_dist_url_search %}http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.brooklyn%22%20AND%20a%3A%22brooklyn-dist%22%20AND%20v%3A%22{{ brooklyn_version }}%22{% endcapture %}
-  {% capture this_alljar_url_search %}http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.brooklyn%22%20AND%20a%3A%22brooklyn-all%22%20AND%20v%3A%22{{ brooklyn_version }}%22{% endcapture %}
-  {% capture this_dist_url_dir %}{{ mavencentral_repo_groupid_url }}brooklyn-dist/{{ brooklyn_version }}/{% endcapture %}
-  {% capture this_alljar_url_dir %}{{ mavencentral_repo_groupid_url }}brooklyn-all/{{ brooklyn_version }}/{% endcapture %}
-  {% capture this_dist_url_zip %}{{ mavencentral_repo_groupid_url }}brooklyn-dist/{{ brooklyn_version }}/brooklyn-dist-{{ brooklyn_version }}-dist.zip{% endcapture %}
-  {% capture this_dist_url_tgz %}{{ mavencentral_repo_groupid_url }}brooklyn-dist/{{ brooklyn_version }}/brooklyn-dist-{{ brooklyn_version }}-dist.tar.gz{% endcapture %}
-  {% capture this_alljar_url_jar %}{{ mavencentral_repo_groupid_url }}brooklyn-all/{{ brooklyn_version }}/brooklyn-all-{{ brooklyn_version }}-with-dependencies.jar{% endcapture %}
-{% endif %}
diff --git a/_plugins/brooklyn_metadata.rb b/_plugins/brooklyn_metadata.rb
new file mode 100644
index 0000000..724906e
--- /dev/null
+++ b/_plugins/brooklyn_metadata.rb
@@ -0,0 +1,60 @@
+# Inserts several useful fields that can be referenced using {{ name }} syntax
+#
+# site.data.brooklyn.version: brooklyn version, such as 0.7.0-M1
+# site.data.brooklyn.is_snapshot: true if this is a snapshot version, otherwise false
+# site.data.brooklyn.url.userguide: URL of the user guide for this version
+#
+module BrooklynMetadata
+
+  BROOKLYN_VERSION = "0.7.0-M1"
+
+  class Generator < Jekyll::Generator
+    def generate(site)
+      is_snapshot = BrooklynMetadata::BROOKLYN_VERSION.end_with?('-SNAPSHOT')
+      
+      if is_snapshot
+        url_set = {
+            "search" => {
+                "all" => "https://oss.sonatype.org/index.html#nexus-search;gav~io.brooklyn~~#{ BrooklynMetadata::BROOKLYN_VERSION }~~",
+                "dist" => "https://oss.sonatype.org/index.html#nexus-search;gav~io.brooklyn~brooklyn-dist~#{ BrooklynMetadata::BROOKLYN_VERSION }~~",
+                "alljar" => "https://oss.sonatype.org/index.html#nexus-search;gav~io.brooklyn~brooklyn-dist~#{ BrooklynMetadata::BROOKLYN_VERSION }~~"
+            },
+            "dist" => {
+                "base" => "https://oss.sonatype.org/content/groups/public/io/brooklyn/brooklyn-dist/#{ BrooklynMetadata::BROOKLYN_VERSION }/",
+                "zip" => "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn&v=#{ BrooklynMetadata::BROOKLYN_VERSION }&a=brooklyn-dist&c=dist&e=zip",
+                "tgz" => "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn&v=#{ BrooklynMetadata::BROOKLYN_VERSION }&a=brooklyn-dist&c=dist&e=tar.gz"
+            },
+            "alljar" => {
+                "base" => "https://oss.sonatype.org/content/groups/public/io/brooklyn/brooklyn-all/#{ BrooklynMetadata::BROOKLYN_VERSION }/",
+                "jar" => "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn&v=#{ BrooklynMetadata::BROOKLYN_VERSION }}&a=brooklyn-all&c=with-dependencies&e=jar"
+            }
+        }
+      else
+        url_set = {
+            "search" => {
+                "all" => "http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.brooklyn%22%20AND%20v%3A%22#{ BrooklynMetadata::BROOKLYN_VERSION }%22",
+                "dist" => "http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.brooklyn%22%20AND%20a%3A%22brooklyn-dist%22%20AND%20v%3A%22#{ BrooklynMetadata::BROOKLYN_VERSION }%22",
+                "alljar" => "http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.brooklyn%22%20AND%20a%3A%22brooklyn-all%22%20AND%20v%3A%22#{ BrooklynMetadata::BROOKLYN_VERSION }%22"
+            },
+            "dist" => {
+                "base" => "http://repo1.maven.org/maven2/io/brooklyn/brooklyn-dist/#{ BrooklynMetadata::BROOKLYN_VERSION }/",
+                "zip" => "http://repo1.maven.org/maven2/io/brooklyn/brooklyn-dist/#{ BrooklynMetadata::BROOKLYN_VERSION }/brooklyn-dist-#{ BrooklynMetadata::BROOKLYN_VERSION }-dist.zip",
+                "tgz" => "http://repo1.maven.org/maven2/io/brooklyn/brooklyn-dist/#{ BrooklynMetadata::BROOKLYN_VERSION }/brooklyn-dist-#{ BrooklynMetadata::BROOKLYN_VERSION }-dist.tar.gz"
+            },
+            "alljar" => {
+                "base" => "http://repo1.maven.org/maven2/io/brooklyn/brooklyn-all/#{ BrooklynMetadata::BROOKLYN_VERSION }/",
+                "jar" => "http://repo1.maven.org/maven2/io/brooklyn/brooklyn-all/#{ BrooklynMetadata::BROOKLYN_VERSION }/brooklyn-all-#{ BrooklynMetadata::BROOKLYN_VERSION }-with-dependencies.jar"
+            }
+        }
+      end
+      
+      url_set['userguide'] = "#{site.config['url']}v/#{BrooklynMetadata::BROOKLYN_VERSION}/"
+      
+      site.data['brooklyn'] = {
+          "version" => BrooklynMetadata::BROOKLYN_VERSION,
+          "is_snapshot" => is_snapshot,
+          "url" => url_set
+      }
+    end
+  end
+end
\ No newline at end of file
diff --git a/quickstart/my-web-cluster.yaml b/quickstart/_my-web-cluster.yaml
similarity index 86%
rename from quickstart/my-web-cluster.yaml
rename to quickstart/_my-web-cluster.yaml
index bbafa00..3b6134b 100644
--- a/quickstart/my-web-cluster.yaml
+++ b/quickstart/_my-web-cluster.yaml
@@ -5,7 +5,7 @@
 - serviceType: brooklyn.entity.webapp.ControlledDynamicWebAppCluster
   name: My Web
   brooklyn.config:
-    wars.root: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/{{ site.brooklyn-version }}/brooklyn-example-hello-world-sql-webapp-{{ site.brooklyn-version }}.war
+    wars.root: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/{{ site.data.brooklyn.version }}/brooklyn-example-hello-world-sql-webapp-{{ site.data.brooklyn.version }}.war
     java.sysprops:
       brooklyn.example.db.url: >
         $brooklyn:formatString("jdbc:%s%s?user=%s\\&password=%s",
diff --git a/quickstart/index.md b/quickstart/index.md
index 81ce7f4..cab4a3f 100644
--- a/quickstart/index.md
+++ b/quickstart/index.md
@@ -4,14 +4,12 @@
 navgroup: getstarted
 ---
 
-{% include fields.md %}
-
 This guide will walk you through deploying an application to a public cloud.
 
 We will be deploying an example 3-tier web application, described using this blueprint: 
 
 {% highlight yaml %}
-{% readj my-web-cluster.yaml %}
+{% readj _my-web-cluster.yaml %}
 {% endhighlight %}
 
 (This is written in YAML, following the [camp specification](https://www.oasis-open.org/committees/camp/). )
@@ -19,7 +17,7 @@
 
 ## Install Brooklyn
 
-Download the [Brooklyn distribution]({{ this_dist_url_tgz }}) and expand it to your home directory ( `~/` ), or in a location of your choice. (Other [download options]({{site.url}}/download.html) are available.)
+Download the [Brooklyn distribution]({{ site.data.brooklyn.url.dist.tgz }}) and expand it to your home directory ( `~/` ), or in a location of your choice. (Other [download options]({{site.url}}/download.html) are available.)
 
 {% if brooklyn_version contains 'SNAPSHOT' %}
 Expand the `tar.gz` archive (note: as this is a -SNAPSHOT version, your filename will be slightly different):
@@ -29,15 +27,15 @@
 
 {% if brooklyn_version contains 'SNAPSHOT' %}
 {% highlight bash %}
-$ tar -zxf brooklyn-dist-{{ brooklyn_version }}-timestamp-dist.tar.gz
+$ tar -zxf brooklyn-dist-{{ site.data.brooklyn.version }}-timestamp-dist.tar.gz
 {% endhighlight %}
 {% else %}
 {% highlight bash %}
-$ tar -zxf brooklyn-dist-{{ brooklyn_version }}-dist.tar.gz
+$ tar -zxf brooklyn-dist-{{ site.data.brooklyn.version }}-dist.tar.gz
 {% endhighlight %}
 {% endif %}
 
-This will create a `brooklyn-{{ brooklyn_version }}` folder.
+This will create a `brooklyn-{{ site.data.brooklyn.version }}` folder.
 
 Note: You'll need a Java JRE or SDK installed (version 6 or later), as Brooklyn is Java under the covers.
 
@@ -48,7 +46,7 @@
 (Click the clipboard on these code snippets for easier c&p.)
 
 {% highlight bash %}
-$ cd brooklyn-{{ brooklyn_version }}
+$ cd brooklyn-{{ site.data.brooklyn.version }}
 $ BROOKLYN_DIR="$(pwd)"
 $ export PATH=$PATH:$BROOKLYN_DIR/bin/
 {% endhighlight %}
@@ -83,12 +81,12 @@
 {% highlight bash %}
 $ mkdir ~/.brooklyn
 $ cd ~/.brooklyn
-$ wget {{site.url}}/use/guide/quickstart/brooklyn.properties
+$ wget {{site.url}}quickstart/brooklyn.properties
 {% endhighlight %}
 
 Open brooklyn.properties in a text editor and add your cloud credentials.
 
-If you would rather test Brooklyn on localhost, follow [these instructions]({{site.url}}/use/guide/locations/) to ensure that your Brooklyn can access your machine.
+If you would rather test Brooklyn on localhost, follow [these instructions]({{ site.data.brooklyn.url.userguide }}use/guide/locations/) to ensure that your Brooklyn can access your machine.
 
 Restart Brooklyn:
 
@@ -127,7 +125,7 @@
 **My Web Cluster Blueprint**
 
 {% highlight yaml %}
-{% readj my-web-cluster.yaml %}
+{% readj _my-web-cluster.yaml %}
 {% endhighlight %}
 
 Paste the modified YAML into the dialog and click 'Finish'.
diff --git a/quickstart/policies-and-catalogs.md b/quickstart/policies-and-catalogs.md
index 9a6d934..b57eb3d 100644
--- a/quickstart/policies-and-catalogs.md
+++ b/quickstart/policies-and-catalogs.md
@@ -4,8 +4,6 @@
 navgroup: getstarted
 ---
 
-{% include fields.md %}
-
 In the [previous step](index.html) we downloaded Brooklyn and used it to deploy an application to a cloud, but at its heart Brooklyn is a policy driven *management* plane.
 
 Here we will introduce Polices using a simple demo app, which we will load from a Service Catalog.
@@ -16,7 +14,7 @@
 
 {% highlight bash %}
 $ cd ~/.brooklyn
-$ wget {{site.url}}/use/guide/quickstart/catalog.xml
+$ wget {{site.data.brooklyn.url.userguide}}/use/guide/quickstart/catalog.xml
 
 $ brooklyn launch
 {% endhighlight %}
@@ -57,7 +55,7 @@
 
 ### Next
 
-The [Elastic Web Cluster Example]({{site.url}}/use/examples/webcluster/index.html) page
+The [Elastic Web Cluster Example]({{site.data.brooklyn.url.userguide}}/use/examples/webcluster/index.html) page
 details how to build this demo application from scratch in Java. It shows in more detail how Brooklyn can
 complement your application with policy driven management, and how applications can be
 run from the command line.