2016-10-15 00:45:21 +00:00
---
2016-12-15 20:16:54 +00:00
title: Writing a New Topic
2016-10-15 00:45:21 +00:00
---
{% capture overview %}
This page shows how to create a new topic for the Kubernetes docs.
{% endcapture %}
{% capture prerequisites %}
Create a fork of the Kubernetes documentation repository as described in
[Creating a Documentation Pull Request ](/docs/contribute/create-pull-request/ ).
{% endcapture %}
{% capture steps %}
2017-01-19 22:37:45 +00:00
## Choosing a page type
2016-10-15 00:45:21 +00:00
As you prepare to write a new topic, think about which of these page types
is the best fit for your content:
< table >
< tr >
< td > Task< / td >
< td > A task page shows how to do a single thing, typically by giving a short sequence of steps. Task pages have minimal explanation, but often provide links to conceptual topics that provide related background and knowledge.< / td >
< / tr >
< tr >
< td > Tutorial< / td >
< td > A tutorial page shows how to accomplish a goal that is larger than a single task. Typically a tutorial page has several sections, each of which has a sequence of steps. For example, a tutorial might provide a walkthrough of a code sample that illustrates a certain feature of Kubernetes. Tutorials can include surface-level explanations, but should link to related concept topics for deep explanations.< / td >
< / tr >
< tr >
< td > Concept< / td >
< td > A concept page explains some aspect of Kubernetes. For example, a concept page might describe the Kubernetes Deployment object and explain the role it plays as an application is deployed, scaled, and updated. Typically, concept pages don't include sequences of steps, but instead provide links to tasks or tutorials.< / td >
< / tr >
2016-11-24 06:14:09 +00:00
< / table >
2016-10-15 00:45:21 +00:00
Each page type has a
[template ](/docs/contribute/page-templates/ )
that you can use as you write your topic.
Using templates helps ensure consistency among topics of a given type.
2017-01-19 22:37:45 +00:00
## Choosing a title and filename
2016-10-15 00:45:21 +00:00
Choose a title that has the keywords you want search engines to find.
Create a filename that uses the words in your title separated by hyphens.
For example, the topic with title
[Using an HTTP Proxy to Access the Kubernetes API ](/docs/tasks/access-kubernetes-api/http-proxy-access-api/ )
has filename `http-proxy-access-api.md` . You don't need to put
"kubernetes" in the filename, because "kubernetes" is already in the
URL for the topic, for example:
http://kubernetes.io/docs/tasks/access-kubernetes-api/http-proxy-access-api/
2017-01-19 22:37:45 +00:00
## Adding the topic title to the front matter
2017-01-10 00:27:41 +00:00
In your topic, put a `title` field in the
[front matter ](https://jekyllrb.com/docs/frontmatter/ ).
2017-01-19 22:37:45 +00:00
The front matter is the YAML block that is between the
2017-01-10 00:27:41 +00:00
triple-dashed lines at the top of the page. Here's an example:
---
title: Using an HTTP Proxy to Access the Kubernetes API
---
2017-01-19 22:37:45 +00:00
## Choosing a directory
2016-10-15 00:45:21 +00:00
Depending on your page type, put your new file in a subdirectory of one of these:
* /docs/tasks/
* /docs/tutorials/
* /docs/concepts/
You can put your file in an existing subdirectory, or you can create a new
subdirectory.
2017-01-19 22:37:45 +00:00
## Creating an entry in the table of contents
2016-10-15 00:45:21 +00:00
Depending page type, create an entry in one of these files:
* /_data/tasks.yaml
* /_data/tutorials.yaml
* /_data/concepts.yaml
2017-01-10 00:27:41 +00:00
Here's an example of an entry in /_data/tasks.yaml:
- docs/tasks/configure-pod-container/configure-volume-storage.md
2017-01-19 22:37:45 +00:00
## Including code from another file
2016-11-24 06:14:09 +00:00
To include a code file in your topic, place the code file in the Kubernetes
documentation repository, preferably in the same directory as your topic
file. In your topic file, use the `include` tag:
< pre > { % include code.html language="< LEXERVALUE> " file="< RELATIVEPATH> " ghlink="/< PATHFROMROOT> " %} < / pre >
where:
* `<LEXERVALUE>` is the language in which the file was written. This must be
[a value supported by Rouge ](https://github.com/jneen/rouge/wiki/list-of-supported-languages-and-lexers ).
* `<RELATIVEPATH>` is the path to the file you're including, relative to the current file, for example, `gce-volume.yaml` .
* `<PATHFROMROOT>` is the path to the file relative to root, for example, `docs/tutorials/stateful-application/gce-volume.yaml` .
Here's an example of using the `include` tag:
< pre > { % include code.html language="yaml" file="gce-volume.yaml" ghlink="/docs/tutorials/stateful-application/gce-volume.yaml" %} < / pre >
2017-01-19 22:37:45 +00:00
## Showing how to create an API object from a configuration file
2016-11-24 06:14:09 +00:00
If you need to show the reader how to create an API object based on a
configuration file, place the configuration file in the Kubernetes documentation
repository, preferably in the same directory as your topic file.
In your topic, show this command:
kubectl create -f http://k8s.io/< PATHFROMROOT >
where `<PATHFROMROOT>` is the path to the configuration file relative to root,
for example, `docs/tutorials/stateful-application/gce-volume.yaml` .
Here's an example of a command that creates an API object from a configuration file:
kubectl create -f http://k8s.io/docs/tutorials/stateful-application/gce-volume.yaml
For an example of a topic that uses this technique, see
[Running a Single-Instance Stateful Application ](/docs/tutorials/stateful-application/run-stateful-application/ ).
2017-01-19 22:37:45 +00:00
## Adding images to a topic
2016-11-24 06:14:09 +00:00
Put image files in the `/images` directory. The preferred
image format is SVG.
2016-10-15 00:45:21 +00:00
{% endcapture %}
{% capture whatsnext %}
* Learn about [using page templates ](/docs/contribute/page-templates/ ).
* Learn about [staging your changes ](/docs/contribute/stage-documentation-changes ).
2016-12-09 00:16:46 +00:00
* Learn about [creating a pull request ](/docs/contribute/create-pull-request/ ).
2016-10-15 00:45:21 +00:00
{% endcapture %}
{% include templates/task.md %}