Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add copy-template script; update instructions

  • Loading branch information...
mbland committed Apr 20, 2015
1 parent 04ec712 commit 2c8e5bcffc9237d8163bd11b117c929c6c69937b
Showing with 68 additions and 10 deletions.
  1. +7 −0 _config.yml
  2. +26 −0 copy-template
  3. +17 −6 index.md
  4. +13 −0 pages/config.md
  5. +5 −4 pages/github.md
@@ -1,6 +1,13 @@
baseurl: /guides-template
markdown: redcarpet
name: 18F Guides Template
exclude:
- go
- copy-template
- Gemfile
- Gemfile.lock
- README.md
- LICENSE.md

permalink: pretty

@@ -0,0 +1,26 @@
#! /bin/bash

usage() {
echo "Usage: $0 [path to target repository]"
exit 1
}

if [ $# -ne 1 ]; then
echo "Error: Exactly one target repository must be specified"
usage
fi

if [ ! -d $1 ]; then
echo "Error: $1 is not a directory"
usage
fi

# Hack per:
# http://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
pushd $(dirname $0) >/dev/null
TEMPLATE_ROOT=$(pwd -P)
popd >/dev/null

PATH=/usr/bin
TARGET=$(echo "$1/" | sed 's#//$#/#')
rsync -av --exclude .DS_Store $TEMPLATE_ROOT/{_includes,_layouts,assets} $TARGET
@@ -21,10 +21,21 @@ table of contents.

## Updating an existing guide

Copy the `_includes`, `_layouts`, and `assets` directories from this template
and follow the instructions in _Updating the Config File_ to update your
`_config.yml` accordingly.
First, clone this template:

You may also need to consult the _GitHub Setup_ and _Post Your Guide_ chapters
to ensure your guide is correctly published to `18f.github.io` and linked from
the main [18F Guides](http://18f.github.io/guides/) site.
```
$ git clone git@github.com:18F/guides-template.git
```

Run the `copy-template` script from this template, passing the path to your
guide's repository as the argument (replacing `MY-EXISTING-GUIDE` below):

```
$ guides-template/copy-template MY-EXISTING-GUIDE
```

Follow the instructions in _Updating the Config File_ to update your
`_config.yml` accordingly. You may also need to consult the _GitHub Setup_ and
_Post Your Guide_ chapters to ensure your guide is correctly published to
`18f.github.io` and linked from the main [18F
Guides](http://18f.github.io/guides/) site.
@@ -4,6 +4,7 @@ layout: default
title: Updating the Config File
---
- [Set the base URL and guide name](#set-baseurl-and-name)
- [Copy the `exclude:` entries](#copy-exclude-entries)
- [Register new pages](#register-new-pages)
- [Update the repository list](#update-repository-list)

@@ -33,13 +34,25 @@ The URLs of the individual section pages are relative to the `baseurl:`. For
example, the `permalink:` of this page is `{{page.permalink}}`. The full local
URL is `http://localhost:4000{{site.baseurl}}{{page.permalink}}`.

## <a name="copy-exclude-entries"></a>Copy the `exclude:` entries

Make sure that you update the `exclude:` list to contain at least the
following files so that they are not copied to your generated `_site`
directory:

```yaml
exclude:
{% for i in site.exclude %}{% if i != 'copy-template' %}- {{ i }}
{% endif %}{% endfor %}```
## <a name="register-new-pages"></a>Register new pages
The `navigation:` list is used to generate the table of contents. Add a new
entry for any new page added. For example, the `navigation:` section of this
guide contains:
```yaml
navigation:
{% for i in site.navigation %}- text: {{ i.text }}
url: {{ i.url }}
internal: {{ i.internal }}
@@ -12,12 +12,13 @@ publish your guide.

## <a name="create-local-repo"></a>Create a new local repository

Once you've got the `_config.yml` file up-to-date, copy and paste these
commands to remove all of the pages and images that came with this template
(careful not to remove any files that you actually intend to keep):
Once you've got the `_config.yml` file up-to-date, in the root directory of
your guide's repository, copy and paste these commands to remove all of the
pages and images that came with this template (careful not to remove any files
that you actually intend to keep):

```
$ rm {% for p in site.pages %}{% if p.path contains 'pages/' %}{{ p.path }} {% endif %}{% endfor %}
$ rm copy-template {% for p in site.pages %}{% if p.path contains 'pages/' %}{{ p.path }} {% endif %}{% endfor %}
$ rm {% for f in site.static_files %}{% if f.path contains '/images/' %}{{ f.path | replace_first:'/','' }} {% endif %}{% endfor %}
```

0 comments on commit 2c8e5bc

Please sign in to comment.
You can’t perform that action at this time.