guide-paging
diff --git a/docs/_config.yml b/docs/_config.yml
index 554db85..0c0d5c0 100644
--- a/docs/_config.yml
+++ b/docs/_config.yml
@@ -4,3 +4,6 @@
version: 3.0.5
paginate: 5
paginate_path: "blog/page:num"
+collections:
+ guides:
+ output: true
diff --git a/docs/guides-async-code.md b/docs/_guides/async-code.md
similarity index 96%
rename from docs/guides-async-code.md
rename to docs/_guides/async-code.md
index 537a7ca..37d038c 100644
--- a/docs/guides-async-code.md
+++ b/docs/_guides/async-code.md
@@ -1,5 +1,6 @@
---
-layout: 2ColLeft
+index: 6
+layout: guide
title: Asynchronous code
sidebar: guides_nav.html
---
@@ -45,7 +46,7 @@
1. Callbacks easily lead to spaghetti code, or to the [pyramid of doom](https://medium.com/@wavded/managing-node-js-callback-hell-1fe03ba8baf).
2. Promises generally lead to better code organization, although they do have a steep learning curve.
-If you already understand promises, you can [skip to the next section](guides-updating-deleting.html).
+If you already understand promises, you can [skip to the next section](updating-deleting.html).
Understanding promises
---------
@@ -223,4 +224,4 @@
Next
------
-Now that you have a grasp on promises, [let's learn about updating and deleting documents](guides-updating-deleting.html).
\ No newline at end of file
+Now that you have a grasp on promises, let's learn about updating and deleting documents.
\ No newline at end of file
diff --git a/docs/guides-attachments.md b/docs/_guides/attachments.md
similarity index 98%
rename from docs/guides-attachments.md
rename to docs/_guides/attachments.md
index a0de8d4..7fc449e 100644
--- a/docs/guides-attachments.md
+++ b/docs/_guides/attachments.md
@@ -1,5 +1,6 @@
---
-layout: 2ColLeft
+index: 9
+layout: guide
title: Working with attachments
sidebar: guides_nav.html
---
@@ -182,4 +183,4 @@
Next
----
-Now that you can attach cat pictures to all your documents (and why wouldn't you?), let's talk about [replication](guides-replication.html).
\ No newline at end of file
+Now that you can attach cat pictures to all your documents (and why wouldn't you?), let's talk about replication.
\ No newline at end of file
diff --git a/docs/guides-bulk-operations.md b/docs/_guides/bulk-operations.md
similarity index 97%
rename from docs/guides-bulk-operations.md
rename to docs/_guides/bulk-operations.md
index 02120ed..0694cef 100644
--- a/docs/guides-bulk-operations.md
+++ b/docs/_guides/bulk-operations.md
@@ -1,5 +1,6 @@
---
-layout: 2ColLeft
+index: 8
+layout: guide
title: Bulk operations
sidebar: guides_nav.html
---
@@ -128,4 +129,4 @@
Next
------
-Now that you've fallen helplessly in love with `bulkDocs()` and `allDocs()`, let's [turn our wandering gaze to attachments](guides-attachments.html).
\ No newline at end of file
+Now that you've fallen helplessly in love with `bulkDocs()` and `allDocs()`, let's turn our wandering gaze to attachments.
\ No newline at end of file
diff --git a/docs/guides-databases.md b/docs/_guides/databases.md
similarity index 96%
rename from docs/guides-databases.md
rename to docs/_guides/databases.md
index 3e9f0e6..8a60f4c 100644
--- a/docs/guides-databases.md
+++ b/docs/_guides/databases.md
@@ -1,5 +1,6 @@
---
-layout: 2ColLeft
+index: 4
+layout: guide
title: Working with databases
sidebar: guides_nav.html
---
@@ -121,4 +122,4 @@
Next
-------
-Now that you've created some databases, let's [put some documents in 'em](guides-documents.html)!
\ No newline at end of file
+Now that you've created some databases, let's put some documents in 'em!
\ No newline at end of file
diff --git a/docs/guides-documents.md b/docs/_guides/documents.md
similarity index 96%
rename from docs/guides-documents.md
rename to docs/_guides/documents.md
index d553760..2ddbffa 100644
--- a/docs/guides-documents.md
+++ b/docs/_guides/documents.md
@@ -1,5 +1,6 @@
---
-layout: 2ColLeft
+index: 5
+layout: guide
title: Working with documents
sidebar: guides_nav.html
---
@@ -187,4 +188,4 @@
Next
----
-Now that you understand a bit about how to create and update documents, let's take a small detour to talk about [asynchronous code](guides-async-code.html).
\ No newline at end of file
+Now that you understand a bit about how to create and update documents, let's take a small detour to talk about asynchronous code.
\ No newline at end of file
diff --git a/docs/guides-intro.md b/docs/_guides/index.md
similarity index 97%
rename from docs/guides-intro.md
rename to docs/_guides/index.md
index 6869b2b..258e0b5 100644
--- a/docs/guides-intro.md
+++ b/docs/_guides/index.md
@@ -1,5 +1,7 @@
---
-layout: 2ColLeft
+index: 1
+layout: guide
+nav: Intro
title: Introduction to PouchDB
sidebar: guides_nav.html
---
@@ -53,4 +55,4 @@
Next
-----
-Now that you understand the basics of the PouchDB/CouchDB universe, let's [set up CouchDB](guides-setup-couchdb.html).
\ No newline at end of file
+Now that you understand the basics of the PouchDB/CouchDB universe, let's set up CouchDB!
\ No newline at end of file
diff --git a/docs/guides-replication.md b/docs/_guides/replication.md
similarity index 93%
rename from docs/guides-replication.md
rename to docs/_guides/replication.md
index a70a6ae..30c0ed9 100644
--- a/docs/guides-replication.md
+++ b/docs/_guides/replication.md
@@ -1,5 +1,6 @@
---
-layout: 2ColLeft
+index: 10
+layout: guide
title: Replication
sidebar: guides_nav.html
---
@@ -24,7 +25,7 @@
every node is **A**vailable, and it's only eventually **C**onsistent.
To illustrate, imagine a multi-node architecture with CouchDB servers spread across several continents. As long as you're willing to wait, the data will eventually flow
-from Australia to Europe to North America to wherver. Users around the world running PouchDB in their browsers or the Couchbase/Cloudant mobile libraries smartphones experience the
+from Australia to Europe to North America to wherever. Users around the world running PouchDB in their browsers or the Couchbase/Cloudant mobile libraries smartphones experience the
same privileges. The data won't show up instantaneously, but depending on the Internet connection speed, it's usually close enough to real-time.
In cases of conflict, CouchDB will choose an arbitrary winner that every node can agree upon deterministically. However, conflicts are still stored in the **revision tree** (similar to a Git history tree), which means that app developers can either surface the conflicts to the user, or just ignore them.
@@ -43,7 +44,7 @@
or remote PouchDBs:
```js
-var remoteDB = new PouchDB('http://localhost:5984/myremotedb)
+var remoteDB = new PouchDB('http://localhost:5984/myremotedb')
```
This comes in handy when you want to share data between the two between the two.
diff --git a/docs/guides-setup-couchdb.md b/docs/_guides/setup-couchdb.md
similarity index 95%
rename from docs/guides-setup-couchdb.md
rename to docs/_guides/setup-couchdb.md
index 9cac591..a893ced 100644
--- a/docs/guides-setup-couchdb.md
+++ b/docs/_guides/setup-couchdb.md
@@ -1,5 +1,6 @@
---
-layout: 2ColLeft
+index: 2
+layout: guide
title: Setting up CouchDB
sidebar: guides_nav.html
---
@@ -90,4 +91,4 @@
Next
-------
-Now that you have CouchDB installed, let's [install PouchDB](guides-setup-pouchdb.html).
\ No newline at end of file
+Now that you have CouchDB installed, let's install PouchDB.
\ No newline at end of file
diff --git a/docs/guides-setup-pouchdb.md b/docs/_guides/setup-pouchdb.md
similarity index 89%
rename from docs/guides-setup-pouchdb.md
rename to docs/_guides/setup-pouchdb.md
index 5fab952..ae21fc3 100644
--- a/docs/guides-setup-pouchdb.md
+++ b/docs/_guides/setup-pouchdb.md
@@ -1,5 +1,6 @@
---
-layout: 2ColLeft
+index: 3
+layout: guide
title: Setting up PouchDB
sidebar: guides_nav.html
---
@@ -9,7 +10,7 @@
Direct download
------
-
+
Download the latest **pouchdb-{{site.version}}.min.js** from the big green button above. Then in your `index.html`:
```html
@@ -73,4 +74,4 @@
Next
-------
-Now that you have PouchDB installed, let's start [working with databases](guides-databases.html).
\ No newline at end of file
+Now that you have PouchDB installed, let's start working with databases.
\ No newline at end of file
diff --git a/docs/guides-updating-deleting.md b/docs/_guides/updating-deleting.md
similarity index 96%
rename from docs/guides-updating-deleting.md
rename to docs/_guides/updating-deleting.md
index c41980c..8736a4f 100644
--- a/docs/guides-updating-deleting.md
+++ b/docs/_guides/updating-deleting.md
@@ -1,5 +1,7 @@
---
-layout: 2ColLeft
+index: 7
+layout: guide
+nav: Updating/deleting documents
title: Updating and deleting documents
sidebar: guides_nav.html
---
@@ -138,4 +140,4 @@
Next
--------
-Now that we understand how to update and delete documents, [let's do it in bulk](guides-bulk-operations.html).
\ No newline at end of file
+Now that we understand how to update and delete documents, let's do it in bulk.
\ No newline at end of file
diff --git a/docs/_includes/guides_nav.html b/docs/_includes/guides_nav.html
index 61c8e83..d37e091 100644
--- a/docs/_includes/guides_nav.html
+++ b/docs/_includes/guides_nav.html
@@ -1,14 +1,8 @@
-<li><a href="{{ site.baseurl }}/guides-intro.html">Intro</a></li>
-<li><a href="{{ site.baseurl }}/guides-setup-couchdb.html">Setting up CouchDB</a></li>
-<li><a href="{{ site.baseurl }}/guides-setup-pouchdb.html">Setting up PouchDB</a></li>
-<li><a href="{{ site.baseurl }}/guides-databases.html">Working with databases</a></li>
-<li><a href="{{ site.baseurl }}/guides-documents.html">Working with documents</a></li>
-<li><a href="{{ site.baseurl }}/guides-async-code.html">Asynchronous code</a></li>
-<li><a href="{{ site.baseurl }}/guides-updating-deleting.html">Updating/deleting documents</a></li>
-<li><a href="{{ site.baseurl }}/guides-bulk-operations.html">Bulk operations</a></li>
-<li><a href="{{ site.baseurl }}/guides-attachments.html">Working with attachments</a></li>
-<li><a href="{{ site.baseurl }}/guides-replication.html">Replication</a></li>
-<li><a href="{{ site.baseurl }}/guides-conflicts.html">Conflicts</a></li>
-<li><a href="{{ site.baseurl }}/guides-views.html">Views and queries</a></li>
-<li><a href="{{ site.baseurl }}/guides-deleting-databases.html">Deleting databases</a></li>
-<li><a href="{{ site.baseurl }}/guides-plugins.html">Plugins</a></li>
+{% assign guides = (site.guides | sort: 'index') %}
+{% for guide in guides %}
+ {% assign title = guide.title %}
+ {% if guide.nav %}
+ {% assign title = guide.nav %}
+ {% endif %}
+ {% include nav_item.html path=guide.url text=title %}
+{% endfor %}
diff --git a/docs/_includes/nav.html b/docs/_includes/nav.html
index 252c69f..88138a9 100644
--- a/docs/_includes/nav.html
+++ b/docs/_includes/nav.html
@@ -1,7 +1,7 @@
-<li><a href="{{ site.baseurl }}/learn.html">About PouchDB</a></li>
-<li><a href="{{ site.baseurl }}/getting-started.html">Get Started Guide</a></li>
-<li><a href="{{ site.baseurl }}/api.html">API</a></li>
-<li><a href="{{ site.baseurl }}/adapters.html">Adapters</a></li>
-<li><a href="{{ site.baseurl }}/external.html">Plugins</a></li>
-<li><a href="{{ site.baseurl }}/faq.html">FAQ</a></li>
-<li><a href="{{ site.baseurl }}/errors.html">Common Errors</a></li>
+{% include nav_item.html path="/learn.html" text="About PouchDB" %}
+{% include nav_item.html path="/getting-started.html" text="Get Started Guide" %}
+{% include nav_item.html path="/api.html" text="API" %}
+{% include nav_item.html path="/adapters.html" text="Adapters" %}
+{% include nav_item.html path="/external.html" text="Plugins" %}
+{% include nav_item.html path="/faq.html" text="FAQ" %}
+{% include nav_item.html path="/errors.html" text="Common Errors" %}
diff --git a/docs/_includes/nav_item.html b/docs/_includes/nav_item.html
new file mode 100644
index 0000000..c857389
--- /dev/null
+++ b/docs/_includes/nav_item.html
@@ -0,0 +1,3 @@
+<li {% if page.url == include.path %} class="active" {% endif %}>
+ <a href="{{ site.baseurl }}{{ include.path | replace:'index.html','' }}">{{ include.text }}</a>
+</li>
diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html
index 054ff52..6f9ab4b 100644
--- a/docs/_layouts/default.html
+++ b/docs/_layouts/default.html
@@ -38,10 +38,10 @@
<ul class='nav nav-header nav-pills'>
<li>
- <a class='btn btn-link btn-lg' href="{{ site.baseurl }}/blog/index.html">Blog</a>
+ <a class='btn btn-link btn-lg' href="{{ site.baseurl }}/blog/">Blog</a>
</li>
<li>
- <a class='btn btn-link btn-lg' href="{{ site.baseurl }}/guides-intro.html">Guides</a>
+ <a class='btn btn-link btn-lg' href="{{ site.baseurl }}/guides/">Guides</a>
</li>
<li>
<a class='btn btn-link btn-lg' href="{{ site.baseurl }}/api.html">API</a>
diff --git a/docs/_layouts/guide.html b/docs/_layouts/guide.html
new file mode 100644
index 0000000..bee6fb2
--- /dev/null
+++ b/docs/_layouts/guide.html
@@ -0,0 +1,25 @@
+---
+layout: 2ColLeft
+---
+{{ content }}
+
+{% assign guides = (site.guides | sort: 'index') %}
+{% for guide in guides %}
+ {% if page.title == guide.title %}
+ {% assign prev = guide.index | minus: 2 %}
+ {% assign next = guide.index %}
+
+ <ul class="pager">
+ {% unless prev == -1 %}
+ <li class="previous">
+ <a href="{{ guides[prev].url }}">← {{ guides[prev].title }}</a>
+ </li>
+ {% endunless %}
+ {% if guides[next] %}
+ <li class="next">
+ <a href="{{ guides[next].url }}">{{ guides[next].title }} →</a>
+ </li>
+ {% endif %}
+ </ul>
+ {% endif %}
+{% endfor %}
diff --git a/docs/guides-conflicts.md b/docs/guides-conflicts.md
deleted file mode 100644
index 12164b0..0000000
--- a/docs/guides-conflicts.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-layout: 2ColLeft
-title: Conflicts
-sidebar: guides_nav.html
----
\ No newline at end of file
diff --git a/docs/static/less/pouchdb/pouchdb.less b/docs/static/less/pouchdb/pouchdb.less
index ab3d21c..ccf8d93 100644
--- a/docs/static/less/pouchdb/pouchdb.less
+++ b/docs/static/less/pouchdb/pouchdb.less
@@ -24,6 +24,7 @@
// Components
@import "@{bootstrap}/media.less";
@import "@{bootstrap}/pagination.less";
+@import "@{bootstrap}/pager.less";
// Utility classes
@import "@{bootstrap}/responsive-utilities.less";