@@ -17,7 +17,7 @@ to run the app on `http://localhost:3000`
17
17
pnpm dev
18
18
```
19
19
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.
21
21
For writing the actual docs, the only real important folder is ` /src/pages ` .
22
22
This is basically the root of the application. The folders create the menu
23
23
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
35
35
36
36
## Adding a page
37
37
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.
39
39
Be aware that the tree can not be deeper than ** 3** folders.
40
40
41
- All the documentation is written in markdown.
41
+ All the documentation is written in markdown.
42
42
Markdown is a lightweight markup language that you can use to add formatting
43
43
elements to plaintext text documents. You can learn more about
44
44
[ Markdown here] ( https://www.markdownguide.org/ ) .
@@ -68,6 +68,7 @@ subTitle: It's new!
68
68
description : The new documentation website is better than ever
69
69
menu : New docs
70
70
label : New docs
71
+ editLink : https://github.com/kadena-community/kadena.js/edit/main/packages/tools/cookbook/README.md
71
72
publishDate : 1977-10-13
72
73
headerImage : /assets/blog/2020/1_b97oiC8M_ePx83B-PW0Cfg.webp
73
74
author : He-man
@@ -76,39 +77,54 @@ layout: blog
76
77
---
77
78
```
78
79
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
81
82
` subTitle ` : not required. Only used when on landing page layout. ` description ` :
82
83
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.
88
93
` headerImage ` : not required. only used for the blogchain as the main header on
89
- top of the article.
94
+ top of the article.
90
95
` author ` : _ depricated_ ! not required. for blogchain we used to JUST show the
91
- author name.
96
+ author name.
92
97
` 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.
95
100
` tags ` : not required. An Array of strings that clarify what the content is
96
101
about. It is shown on blogchain pages, but is also used in the search indexing
97
102
to get better search results.
98
103
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
+
99
115
### Assets
100
116
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 ` .
102
118
You can make as many subfolders as you see fit.
103
119
104
120
### H1
105
121
106
- Every page's content should also start with an ` h1 ` header.
122
+ Every page's content should also start with an ` h1 ` header.
107
123
If the ` h1 ` header does not exist, the build scripts will give you a warning.
108
124
109
125
### Layout
110
126
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.
112
128
` full ` , ` landing ` , ` blog ` , ` home ` and ` redocly ` .
113
129
114
130
#### Full layout
@@ -121,14 +137,14 @@ most room for the actual content.
121
137
122
138
![ the layout] ( ./public/assets/layout_landing.png ) If a section needs a special
123
139
page landing page, to give it a bit more visibility we can use the landing
124
- layout.
140
+ layout.
125
141
It has a large header that uses the ` title ` and ` subTitle ` from the frontmatter.
126
142
127
143
#### Blog layout
128
144
129
145
![ the layout] ( ./public/assets/layout_blog.png ) This layout is actually only used
130
146
for blog posts. It shows the large ` headerImage ` from the frontmatter, if
131
- available.
147
+ available.
132
148
It also shows the author info and ` tags ` from the frontmatter, if available.
133
149
Itdoes not have any sidemenus.
134
150
@@ -141,15 +157,15 @@ swagger API info. Not to be used for other documentation.
141
157
142
158
![ the layout] ( ./public/assets/layout_home.png ) The ` home ` layout is not really
143
159
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.
145
161
It has a header that needs to be custom made for that page and we can do with
146
162
the rest of the layout what ever we want.
147
163
148
164
## Moving pages around
149
165
150
166
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.
153
169
** Important:**
154
170
155
171
- 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.
159
175
get a 404.
160
176
- Please check analytics how many visits does this page get?
161
177
- If the page gets a lot of visits you can at a 301 redirect in
162
- ` next.confing.mjs ` .
178
+ ` next.confing.mjs ` .
163
179
This will redirect all the old links to the new URL.
164
180
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
+
165
204
## Checking documentation validity
166
205
167
206
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.
177
216
These scripts help us with importing some docs, identifying issues with the
178
217
markdown files etc.
179
218
180
- ` importAllReadmes.mjs `
219
+ ` importAllReadmes.mjs `
181
220
This script will import some documentation from other packages of this repo.
182
221
183
- ` createDocsTree.mjs `
222
+ ` createDocsTree.mjs `
184
223
This will create a large ` json ` file with the complete menu structure of the
185
224
whole app, together with some extra meta data. This file is super useful in the
186
225
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.
192
231
` detectBrokenLinks.mjs ` This will walk through all the documentation and check
193
232
all the internal links. To check if they are pointing to an actual file. This
194
233
will prevent 404's in our page when documentation is removed or moved to a
195
- different menu/folder.
234
+ different menu/folder.
196
235
It will also check for certain domains that are not allowed anymore. Think about
197
236
` pact-language.readthedocs.io ` or ` medium.com/kadena-io ` . Also it will rename
198
237
some links (from documentation that was imported) from https://docs.kadena.io to
199
238
internal links.
200
239
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.
203
242
Important for SEO.
204
243
205
- ` checkAuthors.mjs `
244
+ ` checkAuthors.mjs `
206
245
Blog posts have author information. This script checks that this author
207
246
information is valid for our website.
208
247
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 ` .
211
250
This file is later imported by search engines to know what is needed to be
212
251
craweled. Important for SEO.
213
252
214
- ` copyFavIcons.mjs `
253
+ ` copyFavIcons.mjs `
215
254
copy all the fav icons from ` /common/images/icons ` package in the monorepo.
216
255
217
256
## Cli
218
257
219
258
The CLI is a TODO.
220
259
221
260
- 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)
223
262
- can we do something like 'docs-prettier'?
224
263
225
264
## Adding issues
226
265
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