Skip to content

Commit c9f5a71

Browse files
[DOCS]chore: Improve the writers readme (#1146)
* improve the writers readme * update docs issues link --------- Co-authored-by: Mohamed Ismail <[email protected]>
1 parent 00d130a commit c9f5a71

File tree

2 files changed

+76
-45
lines changed

2 files changed

+76
-45
lines changed

.changeset/rude-icons-film.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/apps/docs/README.md

+74-45
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ to run the app on `http://localhost:3000`
1717
pnpm dev
1818
```
1919

20-
Most of the files are just there for the application it self.
20+
Most of the files are just there for the application it self.
2121
For writing the actual docs, the only real important folder is `/src/pages`.
2222
This is basically the root of the application. The folders create the menu
2323
structure you can find in the application it self. Most of the folders in the
@@ -35,10 +35,10 @@ documentation files and you can do basically do anything with them
3535

3636
## Adding a page
3737

38-
A new page can be placed anywhere in the `src/pages` tree.
38+
A new page can be placed anywhere in the `src/pages` tree.
3939
Be aware that the tree can not be deeper than **3** folders.
4040

41-
All the documentation is written in markdown.
41+
All the documentation is written in markdown.
4242
Markdown is a lightweight markup language that you can use to add formatting
4343
elements to plaintext text documents. You can learn more about
4444
[Markdown here](https://www.markdownguide.org/).
@@ -68,6 +68,7 @@ subTitle: It's new!
6868
description: The new documentation website is better than ever
6969
menu: New docs
7070
label: New docs
71+
editLink: https://github.com/kadena-community/kadena.js/edit/main/packages/tools/cookbook/README.md
7172
publishDate: 1977-10-13
7273
headerImage: /assets/blog/2020/1_b97oiC8M_ePx83B-PW0Cfg.webp
7374
author: He-man
@@ -76,39 +77,54 @@ layout: blog
7677
---
7778
```
7879

79-
Lets go over them 1 by 1.
80-
`title`: the title of the document
80+
Lets go over them 1 by 1.
81+
`title`: the title of the document
8182
`subTitle`: not required. Only used when on landing page layout. `description`:
8283
a short description on what the page is about. This will be used as meta data
83-
for SEO, but can also be used as an excerpt in the search results.
84-
`menu`: the name used in the side or header menu's.
85-
`label`: the name used in the breadcrumbs.
86-
`publishDate`: not required. only used for blogchain, at the moment. And used to
87-
show the user what date the article was first published.
84+
for SEO, but can also be used as an excerpt in the search results.
85+
`menu`: the name used in the side or header menu's.
86+
`label`: the name used in the breadcrumbs.
87+
`editLink`: this is the place where the actual document lives. This particular
88+
`md` file has been imported from somewhere else. The editlink is used at almost
89+
every page, at the bottom. It will show a link to everyone visiting the page.
90+
And they can create a PR with changes. `publishDate`: not required. only used
91+
for blogchain, at the moment. And used to show the user what date the article
92+
was first published.
8893
`headerImage`: not required. only used for the blogchain as the main header on
89-
top of the article.
94+
top of the article.
9095
`author`: _depricated_! not required. for blogchain we used to JUST show the
91-
author name.
96+
author name.
9297
`authorID`: not required. replaced the above `author` field. The ID then reads
93-
the author info from the `./src/data/authors.json`
94-
`layout`: checks what layout the page will use to show the data.
98+
the author info from the `./src/data/authors.json`
99+
`layout`: checks what layout the page will use to show the data.
95100
`tags`: not required. An Array of strings that clarify what the content is
96101
about. It is shown on blogchain pages, but is also used in the search indexing
97102
to get better search results.
98103

104+
### Edit link
105+
106+
For the documentation website we want the community to help out. It would be
107+
great if they help out improving the documentation. Whether it is spelling
108+
mistakes or clarifying sections.
109+
The `editLink` frontmatter property, when available, will show an `edit page`
110+
button at the bottom of the screen. This will send the user to the appropriate
111+
github repo page where they can edit and create a PR with their changes. The
112+
`editLink` will be added to the frontmatter on runtime or, when the doc is
113+
imported from outside the package, it will be added during import.
114+
99115
### Assets
100116

101-
Assets like images can be saved in the following folder `/public/assets`.
117+
Assets like images can be saved in the following folder `/public/assets`.
102118
You can make as many subfolders as you see fit.
103119

104120
### H1
105121

106-
Every page's content should also start with an `h1` header.
122+
Every page's content should also start with an `h1` header.
107123
If the `h1` header does not exist, the build scripts will give you a warning.
108124

109125
### Layout
110126

111-
There are a couple of different layouts that can be used in the application.
127+
There are a couple of different layouts that can be used in the application.
112128
`full`, `landing`, `blog`, `home` and `redocly`.
113129

114130
#### Full layout
@@ -121,14 +137,14 @@ most room for the actual content.
121137

122138
![the layout](./public/assets/layout_landing.png) If a section needs a special
123139
page landing page, to give it a bit more visibility we can use the landing
124-
layout.
140+
layout.
125141
It has a large header that uses the `title` and `subTitle` from the frontmatter.
126142

127143
#### Blog layout
128144

129145
![the layout](./public/assets/layout_blog.png) This layout is actually only used
130146
for blog posts. It shows the large `headerImage` from the frontmatter, if
131-
available.
147+
available.
132148
It also shows the author info and `tags` from the frontmatter, if available.
133149
Itdoes not have any sidemenus.
134150

@@ -141,15 +157,15 @@ swagger API info. Not to be used for other documentation.
141157

142158
![the layout](./public/assets/layout_home.png) The `home` layout is not really
143159
used together with `md` files. It is only used for landing pages of sections and
144-
the actual home page.
160+
the actual home page.
145161
It has a header that needs to be custom made for that page and we can do with
146162
the rest of the layout what ever we want.
147163

148164
## Moving pages around
149165

150166
Moving a page to another place in the tree is as simple as moving a file
151-
somewhere inside the `src/pages` directory.
152-
When the build then runs it is automatically is put in the correct position.
167+
somewhere inside the `src/pages` directory.
168+
When the build then runs it is automatically is put in the correct position.
153169
**Important:**
154170

155171
- Renaming a file will ALSO change the URL.
@@ -159,9 +175,32 @@ When the build then runs it is automatically is put in the correct position.
159175
get a 404.
160176
- Please check analytics how many visits does this page get?
161177
- If the page gets a lot of visits you can at a 301 redirect in
162-
`next.confing.mjs`.
178+
`next.confing.mjs`.
163179
This will redirect all the old links to the new URL.
164180

181+
## Imported docs
182+
183+
Most of the documentation files live in the docs package and can be editted in
184+
place as described. But there are also documentation files that live outside of
185+
this package and are maintained in other packages or repos. These are then
186+
imported and copied in their correct position during build time.
187+
If you have ran the build script once you can see them in your `src/pages` tree.
188+
If you make changes in these files they will be over written the next time you
189+
make a build.
190+
191+
So how do you know if this is an imported file and how can you make changes to
192+
them? In these files there will be a frontmatter property called `editLink`.
193+
When this property exists, this means that this is an imported document. And the
194+
link will be the place where you can edit this particular file.
195+
196+
### Multipage import
197+
198+
Some docs, that are imported, are enourmously lengthy pages that are just to big
199+
to show on 1 page. There we can say, during the import, that it needs to be
200+
broken up. This is done automatically by checking `h2` headers. Every `h2`
201+
header will now be the start of a new page.
202+
The `editLink` frontmatter prop is the same for all these pages.
203+
165204
## Checking documentation validity
166205

167206
To check that all the files are valid and ready to build, but you don't want to
@@ -177,10 +216,10 @@ There are a couple of build scripts running just before the site is put live.
177216
These scripts help us with importing some docs, identifying issues with the
178217
markdown files etc.
179218

180-
`importAllReadmes.mjs`
219+
`importAllReadmes.mjs`
181220
This script will import some documentation from other packages of this repo.
182221

183-
`createDocsTree.mjs`
222+
`createDocsTree.mjs`
184223
This will create a large `json` file with the complete menu structure of the
185224
whole app, together with some extra meta data. This file is super useful in the
186225
app. For instance in finding the next and previous page, so we can use that at
@@ -192,47 +231,37 @@ pact and chainweb api documentation.
192231
`detectBrokenLinks.mjs` This will walk through all the documentation and check
193232
all the internal links. To check if they are pointing to an actual file. This
194233
will prevent 404's in our page when documentation is removed or moved to a
195-
different menu/folder.
234+
different menu/folder.
196235
It will also check for certain domains that are not allowed anymore. Think about
197236
`pact-language.readthedocs.io` or `medium.com/kadena-io`. Also it will rename
198237
some links (from documentation that was imported) from https://docs.kadena.io to
199238
internal links.
200239

201-
`checkForHeaders.mjs`
202-
Checks that every page uses at least an h1 header at the top of the page.
240+
`checkForHeaders.mjs`
241+
Checks that every page uses at least an h1 header at the top of the page.
203242
Important for SEO.
204243

205-
`checkAuthors.mjs`
244+
`checkAuthors.mjs`
206245
Blog posts have author information. This script checks that this author
207246
information is valid for our website.
208247

209-
`createSitemap.mjs`
210-
Creates a sitemap of all the pages and creates a `sitemap.xml`.
248+
`createSitemap.mjs`
249+
Creates a sitemap of all the pages and creates a `sitemap.xml`.
211250
This file is later imported by search engines to know what is needed to be
212251
craweled. Important for SEO.
213252

214-
`copyFavIcons.mjs`
253+
`copyFavIcons.mjs`
215254
copy all the fav icons from `/common/images/icons` package in the monorepo.
216255

217256
## Cli
218257

219258
The CLI is a TODO.
220259

221260
- bootstrap a page
222-
- run build scripts more finegrained (only the import scripts for example)
261+
- run build scripts more fine-grained (only the import scripts for example)
223262
- can we do something like 'docs-prettier'?
224263

225264
## Adding issues
226265

227-
If there are issues with the docs, or you see room for improvements. You can add
228-
stories to the
229-
[asana board](https://app.asana.com/share/kadena/docs-website/392126137019801/549bac730050e5c629d673df5e0e950f)
230-
backlog or ask the questions in the (docs slack
231-
channel)[https://kadena-io.slack.com/archives/C04QZH1562X].
232-
233-
Sorry these links are for internal Kadena use only. If you want to contribute to
234-
the docs as a communitymember, that would be great of course. We would really
235-
appreciate it. All the things mentioned above should work as expected. And if
236-
you have any questions or suggestions. Found any issues you can put them
237-
(here)[https://github.com/kadena-community/kadena.js/issues]. And we try to
238-
contact you there as soon as possible.
266+
If there are any issues with the docs, or you see room for improvements, you can add
267+
stories to: https://github.com/kadena-community/kadena.js/issues

0 commit comments

Comments
 (0)