Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic next/prev links for grouped content #4317

Merged
merged 13 commits into from
Aug 24, 2022
24 changes: 24 additions & 0 deletions app/_assets/stylesheets/pages/docs.less
Original file line number Diff line number Diff line change
Expand Up @@ -792,3 +792,27 @@
font-size: 11px;
}
}

.book-nav-container {
hr {
margin: 1em 0;
}
}

.book-nav {
width: 48%;


.direction {
display: block;
font-weight: bold;
}
margin-bottom: 1em;
}
.book-nav.previous {
float: left;
}
.book-nav.next {
float: right;
text-align: right;
}
19 changes: 18 additions & 1 deletion app/_layouts/docs-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,26 @@ <h2 class="page-content-subtitle">{{page.subtitle | flatify }}</h2>
<a href="/konnect/">current {{site.konnect_short_name}} documentation</a>.
</blockquote>
{% endif %}

{{ content }}

{% if page.book %}
<div class="book-nav-container">
<hr />
{% if page.book.previous %}
<div class="book-nav previous">
<span class="direction">Previous</span>
<a href="{{ page.book.previous.url }}">{{ page.book.previous.title }}</a>
</div>
{% endif %}
{% if page.book.next %}
<div class="book-nav next">
<span class="direction">Next</span>
<a href="{{ page.book.next.url }}">{{ page.book.next.title }}</a>
</div>
{% endif %}
</div>
{% endif %}

</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/_plugins/generators/book.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def generate(site) # rubocop:disable Metrics/PerceivedComplexity, Metrics/Cyclom
'chapters' => {}
}

page.data['book']['previous'] = pages[idx - 1].url if idx.positive?
page.data['book']['previous'] = pages[idx - 1] if idx.positive?

page.data['book']['next'] = pages[idx + 1].url if idx < pages.size - 1
page.data['book']['next'] = pages[idx + 1] if idx < pages.size - 1

# Add all existing pages links to this page
pages.each do |p|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,4 @@ local inserted_plugin, err = kong.db.plugins:insert({
For a real-life example of the DAO being used in a plugin, see the
[Key-Auth plugin source code](https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/handler.lua).

---

Next: [Storing Custom Entities &rsaquo;]({{page.book.next}})

[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
4 changes: 0 additions & 4 deletions app/enterprise/2.1.x/plugin-development/admin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,4 @@ three functions:
- The `PUT` function populates `self.args.post.consumer` before calling the `endpoints`-provided
`put_entity_endpoint` function.

---

Next: [Write tests for your plugin]({{page.book.next}})

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
8 changes: 2 additions & 6 deletions app/enterprise/2.1.x/plugin-development/custom-entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ its configuration in the database. In that case, Kong provides you with
an abstraction on top of its primary datastores which allows you to store
custom entities.

As explained in the [previous chapter]({{page.book.previous}}), Kong interacts
As explained in the [previous chapter]({{page.book.previous.url}}), Kong interacts
with the model layer through classes we refer to as "DAOs", and available on a
singleton often referred to as the "DAO Factory". This chapter will explain how
to to provide an abstraction for your own entities.
Expand Down Expand Up @@ -635,11 +635,7 @@ When a custom entity is required on every request/response it is good practice
to cache it in-memory by leveraging the in-memory cache API provided by Kong.

The next chapter will focus on caching custom entities, and invalidating them
when they change in the datastore: [Caching custom entities]({{page.book.next}}).

---

Next: [Caching custom entities &rsaquo;]({{page.book.next}})
when they change in the datastore: [Caching custom entities]({{page.book.next.url}}).

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
6 changes: 1 addition & 5 deletions app/enterprise/2.1.x/plugin-development/custom-logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ All of those functions, except `init_worker`, take one parameter which is given
by Kong upon its invocation: the configuration of your plugin. This parameter
is a Lua table, and contains values defined by your users, according to your
plugin's schema (described in the `schema.lua` module). More on plugins schemas
in the [next chapter]({{page.book.next}}).
in the [next chapter]({{page.book.next.url}}).

[HTTP Module]: https://github.com/openresty/lua-nginx-module
[Stream Module]: https://github.com/openresty/stream-lua-nginx-module
Expand Down Expand Up @@ -320,9 +320,5 @@ syslog | 4
request-termination | 2
post-function | -1000

---

Next: [Plugin configuration &rsaquo;]({{page.book.next}})

[lua-nginx-module]: https://github.com/openresty/lua-nginx-module
[pdk]: /enterprise/{{page.kong_version}}/pdk
8 changes: 2 additions & 6 deletions app/enterprise/2.1.x/plugin-development/entities-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ chapter: 7
## Introduction

Your plugin may need to frequently access custom entities (explained in the
[previous chapter]({{page.book.previous}})) on every request and/or response.
[previous chapter]({{page.book.previous.url}})) on every request and/or response.
Usually, loading them once and caching them in-memory dramatically improves
the performance while making sure the datastore is not stressed with an
increased load.
Expand Down Expand Up @@ -339,11 +339,7 @@ Kong to setup their APIs and plugins. It is likely that they also need to be
able to interact with the custom entities you implemented for your plugin (for
example, creating and deleting API keys). The way you would do this is by
extending the Admin API, which we will detail in the next chapter:
[Extending the Admin API]({{page.book.next}}).

---

Next: [Extending the Admin API &rsaquo;]({{page.book.next}})
[Extending the Admin API]({{page.book.next.url}}).

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
4 changes: 0 additions & 4 deletions app/enterprise/2.1.x/plugin-development/file-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ master each one of them.
The [Key-Auth plugin] is an example of plugin with this file structure.
See [its source code] for more details.

---

Next: [Write custom logic &rsaquo;]({{page.book.next}})

[api.lua]: {{page.book.chapters.admin-api}}
[daos.lua]: {{page.book.chapters.custom-entities}}
[handler.lua]: {{page.book.chapters.custom-logic}}
Expand Down
4 changes: 0 additions & 4 deletions app/enterprise/2.1.x/plugin-development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,5 @@ This guide will explore in detail the structure of plugins, what they can
extend, and how to distribute and install them. For a complete reference of the
PDK, see the [Plugin Development Kit] reference.

---

Next: [File structure of a plugin &rsaquo;]({{page.book.next}})

[lua-nginx-module]: https://github.com/openresty/lua-nginx-module
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,6 @@ return CustomHandler

You can also see a real-world example of schema in [the Key-Auth plugin source code].

---

Next: [Accessing the Datastore &rsaquo;]({{page.book.next}})

[Admin API]: /enterprise/{{page.kong_version}}/admin-api
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
[the Key-Auth plugin source code]: https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/schema.lua
3 changes: 0 additions & 3 deletions app/enterprise/2.1.x/plugin-development/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,3 @@ and Admin API on port 9001.
If you want to see a real-world example, give a look at the
[Key-Auth plugin specs](https://github.com/Kong/kong/tree/master/spec/03-plugins/09-key-auth)

---

Next: [Distribute your plugin &rsaquo;]({{page.book.next}})
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,4 @@ local inserted_plugin, err = kong.db.plugins:insert({
For a real-life example of the DAO being used in a plugin, see the
[Key-Auth plugin source code](https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/handler.lua).

---

Next: [Storing Custom Entities &rsaquo;]({{page.book.next}})

[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
4 changes: 0 additions & 4 deletions app/enterprise/2.2.x/plugin-development/admin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,4 @@ three functions:
- The `PUT` function populates `self.args.post.consumer` before calling the `endpoints`-provided
`put_entity_endpoint` function.

---

Next: [Write tests for your plugin]({{page.book.next}})

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
8 changes: 2 additions & 6 deletions app/enterprise/2.2.x/plugin-development/custom-entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ its configuration in the database. In that case, Kong provides you with
an abstraction on top of its primary datastores which allows you to store
custom entities.

As explained in the [previous chapter]({{page.book.previous}}), Kong interacts
As explained in the [previous chapter]({{page.book.previous.url}}), Kong interacts
with the model layer through classes we refer to as "DAOs", and available on a
singleton often referred to as the "DAO Factory". This chapter will explain how
to to provide an abstraction for your own entities.
Expand Down Expand Up @@ -635,11 +635,7 @@ When a custom entity is required on every request/response it is good practice
to cache it in-memory by leveraging the in-memory cache API provided by Kong.

The next chapter will focus on caching custom entities, and invalidating them
when they change in the datastore: [Caching custom entities]({{page.book.next}}).

---

Next: [Caching custom entities &rsaquo;]({{page.book.next}})
when they change in the datastore: [Caching custom entities]({{page.book.next.url}}).

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
6 changes: 1 addition & 5 deletions app/enterprise/2.2.x/plugin-development/custom-logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ All of those functions, except `init_worker`, take one parameter which is given
by Kong upon its invocation: the configuration of your plugin. This parameter
is a Lua table, and contains values defined by your users, according to your
plugin's schema (described in the `schema.lua` module). More on plugins schemas
in the [next chapter]({{page.book.next}}).
in the [next chapter]({{page.book.next.url}}).

[HTTP Module]: https://github.com/openresty/lua-nginx-module
[Stream Module]: https://github.com/openresty/stream-lua-nginx-module
Expand Down Expand Up @@ -320,9 +320,5 @@ syslog | 4
request-termination | 2
post-function | -1000

---

Next: [Plugin configuration &rsaquo;]({{page.book.next}})

[lua-nginx-module]: https://github.com/openresty/lua-nginx-module
[pdk]: /enterprise/{{page.kong_version}}/pdk
8 changes: 2 additions & 6 deletions app/enterprise/2.2.x/plugin-development/entities-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ chapter: 7
## Introduction

Your plugin may need to frequently access custom entities (explained in the
[previous chapter]({{page.book.previous}})) on every request and/or response.
[previous chapter]({{page.book.previous.url}})) on every request and/or response.
Usually, loading them once and caching them in-memory dramatically improves
the performance while making sure the datastore is not stressed with an
increased load.
Expand Down Expand Up @@ -339,11 +339,7 @@ Kong to setup their APIs and plugins. It is likely that they also need to be
able to interact with the custom entities you implemented for your plugin (for
example, creating and deleting API keys). The way you would do this is by
extending the Admin API, which we will detail in the next chapter:
[Extending the Admin API]({{page.book.next}}).

---

Next: [Extending the Admin API &rsaquo;]({{page.book.next}})
[Extending the Admin API]({{page.book.next.url}}).

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
4 changes: 0 additions & 4 deletions app/enterprise/2.2.x/plugin-development/file-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ master each one of them.
The [Key-Auth plugin] is an example of plugin with this file structure.
See [its source code] for more details.

---

Next: [Write custom logic &rsaquo;]({{page.book.next}})

[api.lua]: {{page.book.chapters.admin-api}}
[daos.lua]: {{page.book.chapters.custom-entities}}
[handler.lua]: {{page.book.chapters.custom-logic}}
Expand Down
4 changes: 0 additions & 4 deletions app/enterprise/2.2.x/plugin-development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,5 @@ This guide will explore in detail the structure of plugins, what they can
extend, and how to distribute and install them. For a complete reference of the
PDK, see the [Plugin Development Kit] reference.

---

Next: [File structure of a plugin &rsaquo;]({{page.book.next}})

[lua-nginx-module]: https://github.com/openresty/lua-nginx-module
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,6 @@ return CustomHandler

You can also see a real-world example of schema in [the Key-Auth plugin source code].

---

Next: [Accessing the Datastore &rsaquo;]({{page.book.next}})

[Admin API]: /enterprise/{{page.kong_version}}/admin-api
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
[the Key-Auth plugin source code]: https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/schema.lua
3 changes: 0 additions & 3 deletions app/enterprise/2.2.x/plugin-development/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,3 @@ and Admin API on port 9001.
If you want to see a real-world example, give a look at the
[Key-Auth plugin specs](https://github.com/Kong/kong/tree/master/spec/03-plugins/09-key-auth)

---

Next: [Distribute your plugin &rsaquo;]({{page.book.next}})
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,4 @@ local inserted_plugin, err = kong.db.plugins:insert({
For a real-life example of the DAO being used in a plugin, see the
[Key-Auth plugin source code](https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/handler.lua).

---

Next: [Storing Custom Entities &rsaquo;]({{page.book.next}})

[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
4 changes: 0 additions & 4 deletions app/enterprise/2.3.x/plugin-development/admin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,4 @@ three functions:
- The `PUT` function populates `self.args.post.consumer` before calling the `endpoints`-provided
`put_entity_endpoint` function.

---

Next: [Write tests for your plugin]({{page.book.next}})

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
8 changes: 2 additions & 6 deletions app/enterprise/2.3.x/plugin-development/custom-entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ its configuration in the database. In that case, Kong provides you with
an abstraction on top of its primary datastores which allows you to store
custom entities.

As explained in the [previous chapter]({{page.book.previous}}), Kong interacts
As explained in the [previous chapter]({{page.book.previous.url}}), Kong interacts
with the model layer through classes we refer to as "DAOs", and available on a
singleton often referred to as the "DAO Factory". This chapter will explain how
to to provide an abstraction for your own entities.
Expand Down Expand Up @@ -635,11 +635,7 @@ When a custom entity is required on every request/response it is good practice
to cache it in-memory by leveraging the in-memory cache API provided by Kong.

The next chapter will focus on caching custom entities, and invalidating them
when they change in the datastore: [Caching custom entities]({{page.book.next}}).

---

Next: [Caching custom entities &rsaquo;]({{page.book.next}})
when they change in the datastore: [Caching custom entities]({{page.book.next.url}}).

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
6 changes: 1 addition & 5 deletions app/enterprise/2.3.x/plugin-development/custom-logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ All of those functions, except `init_worker`, take one parameter which is given
by Kong upon its invocation: the configuration of your plugin. This parameter
is a Lua table, and contains values defined by your users, according to your
plugin's schema (described in the `schema.lua` module). More on plugins schemas
in the [next chapter]({{page.book.next}}).
in the [next chapter]({{page.book.next.url}}).

[HTTP Module]: https://github.com/openresty/lua-nginx-module
[Stream Module]: https://github.com/openresty/stream-lua-nginx-module
Expand Down Expand Up @@ -320,9 +320,5 @@ syslog | 4
request-termination | 2
post-function | -1000

---

Next: [Plugin configuration &rsaquo;]({{page.book.next}})

[lua-nginx-module]: https://github.com/openresty/lua-nginx-module
[pdk]: /enterprise/{{page.kong_version}}/pdk
8 changes: 2 additions & 6 deletions app/enterprise/2.3.x/plugin-development/entities-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ chapter: 7
## Introduction

Your plugin may need to frequently access custom entities (explained in the
[previous chapter]({{page.book.previous}})) on every request and/or response.
[previous chapter]({{page.book.previous.url}})) on every request and/or response.
Usually, loading them once and caching them in-memory dramatically improves
the performance while making sure the datastore is not stressed with an
increased load.
Expand Down Expand Up @@ -339,11 +339,7 @@ Kong to setup their APIs and plugins. It is likely that they also need to be
able to interact with the custom entities you implemented for your plugin (for
example, creating and deleting API keys). The way you would do this is by
extending the Admin API, which we will detail in the next chapter:
[Extending the Admin API]({{page.book.next}}).

---

Next: [Extending the Admin API &rsaquo;]({{page.book.next}})
[Extending the Admin API]({{page.book.next.url}}).

[Admin API]: /enterprise/{{page.kong_version}}/admin-api/
[Plugin Development Kit]: /enterprise/{{page.kong_version}}/pdk
Loading