~erock/pico

ref: 4bad293ba12d5810062e4c9d80844dd875725216 pico/prose/html/help.page.tmpl -rw-r--r-- 15.3 KiB
4bad293bEric Bower docs(prose): add help section for supported hugo variables 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
{{template "base" .}}

{{define "title"}}help -- {{.Site.Domain}}{{end}}

{{define "meta"}}
<meta name="description" content="questions and answers" />
{{end}}

{{define "attrs"}}{{end}}

{{define "body"}}
<header>
    <h1 class="text-2xl">Need help?</h1>
    <p>Here are some common questions on using this platform that we would like to answer.</p>
</header>
<main>
    <section id="permission-denied">
        <h2 class="text-xl">
            <a href="#permission-denied" rel="nofollow noopener">#</a>
            I get a permission denied when trying to SSH
        </h2>
        <p>
            Unfortunately SHA-2 RSA keys are <strong>not</strong> currently supported.
        </p>
        <p>
            Unfortunately, due to a shortcoming in Go’s x/crypto/ssh package, we
            not currently support access via new SSH RSA keys: only the old SHA-1 ones will work.
            Until we sort this out you’ll either need an SHA-1 RSA key or a key with another
            algorithm, e.g. Ed25519. Not sure what type of keys you have? You can check with the
            following:
        </p>
        <pre>$ find ~/.ssh/id_*.pub -exec ssh-keygen -l -f {} \;</pre>
        <p>If you’re curious about the inner workings of this problem have a look at:</p>
        <ul>
            <li><a href="https://github.com/golang/go/issues/37278">golang/go#37278</a></li>
            <li><a href="https://go-review.googlesource.com/c/crypto/+/220037">go-review</a></li>
            <li><a href="https://github.com/golang/crypto/pull/197">golang/crypto#197</a></li>
        </ul>
    </section>

    <section id="blog-ssh-key">
        <h2 class="text-xl">
            <a href="#blog-ssh-key" rel="nofollow noopener">#</a>
            Generating a new SSH key
        </h2>
        <p>
            <a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent">Github reference</a>
        </p>
        <pre>ssh-keygen -t ed25519 -C "your_email@example.com"</pre>
        <ol>
            <li>When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.</li>
            <li>At the prompt, type a secure passphrase.</li>
        </ol>
    </section>

    <section id="blog-structure">
        <h2 class="text-xl">
            <a href="#blog-structure" rel="nofollow noopener">#</a>
            What should my blog folder look like?
        </h2>
        <p>
            Currently {{.Site.Domain}} only supports a flat folder structure.  Therefore,
            <code>scp -r</code> is not permitted.  We also only allow <code>.md</code> files to be
            uploaded.
        </p>
        <p>
            <a href="https://github.com/neurosnap/prose-blog">Here is the source to my blog on this platform</a>
        </p>
        <p>
        Below is an example of what your blog folder should look like:
        </p>
            <pre>blog/
first-post.md
second-post.md
third-post.md</pre>
        </p>
        <p>
            Underscores and hyphens are permitted and will be automatically removed from the title of the post.
        </p>
    </section>

    <section id="post-metadata">
        <h2 class="text-xl">
            <a href="#post-metadata" rel="nofollow noopener">#</a>
            How do I update metadata like publish date and title?
        </h2>
        <p>
        We support adding frontmatter to the top of your markdown posts.  A frontmatter looks like the following:
        <pre>---
title: some title!
description: this is a great description
date: 2022-06-28
---</pre>
        </p>
        <p>
            List of available variables can be found <a href="#hugo-support">here</a>.
        </p>
        <p>
            Common variables:
            <ul>
                <li>title (custom title not dependent on filename)</li>
                <li>description (what is the purpose of this post?  It's also added to meta tag)</li>
                <li>date (format must be YYYY-MM-DD, if set in future post wil be unlisted)</li>
                <li>tags (<code>[feature, announcement]</code>)</li>
            </ul>
        </p>
    </section>

    <section id="post-update">
        <h2 class="text-xl">
            <a href="#post-update" rel="nofollow noopener">#</a>
            How do I update a post?
        </h2>
        <p>
            Updating a post requires that you update the source document and then run the <code>scp</code>
            command again.  If the filename remains the same, then the post will be updated.
        </p>
    </section>

    <section id="post-delete">
        <h2 class="text-xl">
            <a href="#post-delete" rel="nofollow noopener">#</a>
            How do I delete a post?
        </h2>
        <p>
            Because <code>scp</code> does not natively support deleting files, I didn't want to bake
            that behavior into my ssh server.
        </p>

        <p>
            However, if a user wants to delete a post they can delete the contents of the file and
            then upload it to our server.  If the file contains 0 bytes, we will remove the post.
            For example, if you want to delete <code>delete.md</code> you could:
        </p>

        <pre>
cp /dev/null delete.md
scp ./delete.md {{.Site.Domain}}:/</pre>

        <p>
            Alternatively, you can go to <code>ssh {{.Site.Domain}}</code> and select "Manage posts."
            Then you can highlight the post you want to delete and then press "X."  It will ask for
            confirmation before actually removing the post.
        </p>
    </section>

    <section id="blog-upload-single-file">
        <h2 class="text-xl">
            <a href="#blog-upload-single-file" rel="nofollow noopener">#</a>
            When I want to publish a new post, do I have to upload all posts everytime?
        </h2>
        <p>
            Nope!  Just <code>scp</code> the file you want to publish.  For example, if you created
            a new post called <code>taco-tuesday.md</code> then you would publish it like this:
        </p>
        <pre>scp ./taco-tuesday.md {{.Site.Domain}}:</pre>
    </section>

    <section id="blog-readme">
        <h2 class="text-xl">
            <a href="#blog-readme" rel="nofollow noopener">#</a>
            How can I customize my blog page?
        </h2>
        <p>
        There's a special file you can upload `_readme.md` which will allow
        users to add a bio and links to their blog landing page.
        <pre>---
title: some title!
description: this is a great description
nav:
    - google: https://google.com
    - site: https://some.site
---

Here is a quick intro to my personal blog!
This will show up on the blog landing page.
</pre>
        </p>
        <p>
            List of available variables:
            <ul>
                <li>title (name of the blog, default: "X's blog")</li>
                <li>description (description of blog)</li>
                <li>nav (key=value pair that corresponds to text=href in html)</li>
            </ul>
        </p>
    </section>

    <section id="blog-style">
        <h2 class="text-xl">
            <a href="#blog-style" rel="nofollow noopener">#</a>
            How can I change the theme of my blog?
        </h2>
        <p>
            There's a special file you can upload `_styles.css` which will allow
            users to add a CSS file to their page.  It will be the final CSS file
            loaded on the page so it will overwrite whatever styles have previously
            been added.  We've also added a couple of convenience id's attached to the
            body element for the blog and post pages.
        </p>
        <pre>/* _styles.css */
#post {
    color: green;
}

#blog {
    color: tomato;
}</pre>
        <p>Then just upload the file:</p>
        <pre>scp _styles.css <username>@prose.sh:/</pre>
    </section>

    <section id="blog-url">
        <h2 class="text-xl">
            <a href="#blog-url" rel="nofollow noopener">#</a>
            What is my blog URL?
        </h2>
        <pre>https://{username}.{{.Site.Domain}}</pre>
    </section>

    <section id="continuous-deployment">
        <h2 class="text-xl">
            <a href="#continuous-deployment" rel="nofollow noopener">#</a>
            How can I automatically publish my post?
        </h2>
        <p>
            There is a github action that we built to make it easy to publish your blog automatically.
        </p>
        <ul>
            <li>
                <a href="https://github.com/marketplace/actions/scp-publish-action">github marketplace</a>
            </li>
            <li>
                <a href="https://github.com/neurosnap/lists-official-blog/blob/main/.github/workflows/publish.yml">example workflow</a>
            </li>
        </ul>
        <p>
            A user also created a systemd task to automatically publish new posts.  <a href="https://github.com/neurosnap/lists.sh/discussions/24">Check out this github discussion for more details.</a>
        </p>
    </section>

    <section id="multiple-accounts">
        <h2 class="text-xl">
            <a href="#multiple-accounts" rel="nofollow noopener">#</a>
            Can I create multiple accounts?
        </h2>
        <p>
           Yes!  You can either a) create a new keypair and use that for authentication
           or b) use the same keypair and ssh into our CMS using our special username
           <code>ssh new@{{.Site.Domain}}</code>.
        </p>
        <p>
            Please note that if you use the same keypair for multiple accounts, you will need to
            always specify the user when logging into our CMS.
        </p>
    </section>

    <section id="custom-domain">
        <h2 class="text-xl">
            <a href="#custom-domain" rel="nofollow noopener">#</a>
            Setup a custom domain
        </h2>
        <p>
            A blog can be accessed from a custom domain.
            HTTPS will be automatically enabled and a certificate will be retrieved
            from <a href="https://letsencrypt.org/">Let's Encrypt</a>. In order for this to work,
            2 DNS records need to be created:
        </p>

        <p>CNAME for the domain to prose (subdomains or DNS hosting with CNAME flattening) or A record</p>
        <pre>CNAME subdomain.yourcustomdomain.com -> prose.sh</pre>
        <p>Resulting in:</p>
        <pre>subdomain.yourcustomdomain.com.         300     IN      CNAME   prose.sh.</pre>
        <p>And a TXT record to tell Prose what blog is hosted on that domain at the subdomain entry _prose</p>
        <pre>TXT _prose.subdomain.yourcustomdomain.com -> yourproseusername</pre>
        <p>Resulting in:</p>
        <pre>_prose.subdomain.yourcustomdomain.com.         300     IN      TXT     "hey"</pre>
    </section>

    <section id="hugo-support">
        <h2 class="text-xl">
            <a href="#hugo-support" rel="nofollow noopener">#</a>
            Hugo support
        </h2>
        <p>
            We support a subset of pre-defined hugo variables in our frontmatter.
            <a href="https://gohugo.io/content-management/front-matter/">Complete list at Hugo</a>
        </p>
        <table>
            <th>
                <tr>
                    <th align="left">Variable</th>
                    <th>Supported</th>
                    <th>Planned</th>
                </tr>
            </th>

            <tbody>
                <tr>
                    <td>aliases</td>
                    <td>no</td>
                    <td>yes</td>
                </tr>

                <tr>
                    <td>audio</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>cascade</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>date</td>
                    <td>yes</td>
                    <td>-</td>
                </tr>

                <tr>
                    <td>description</td>
                    <td>yes</td>
                    <td>-</td>
                </tr>

                <tr>
                    <td>draft</td>
                    <td>no</td>
                    <td>yes</td>
                </tr>

                <tr>
                    <td>expiryDate</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>headless</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>images</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>isCJKLanguage</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>keywords</td>
                    <td>no</td>
                    <td>yes</td>
                </tr>

                <tr>
                    <td>layout</td>
                    <td>no</td>
                    <td>maybe</td>
                </tr>

                <tr>
                    <td>lastmod</td>
                    <td>no</td>
                    <td>maybe</td>
                </tr>

                <tr>
                    <td>linkTitle</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>markup</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>outputs</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>publishDate</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>resources</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>series</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>slug</td>
                    <td>no</td>
                    <td>yes</td>
                </tr>

                <tr>
                    <td>summary</td>
                    <td>no</td>
                    <td>yes</td>
                </tr>

                <tr>
                    <td>tags</td>
                    <td>yes</td>
                    <td>-</td>
                </tr>

                <tr>
                    <td>title</td>
                    <td>yes</td>
                    <td>-</td>
                </tr>

                <tr>
                    <td>type</td>
                    <td>no</td>
                    <td>maybe</td>
                </tr>

                <tr>
                    <td>url</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>videos</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>weight</td>
                    <td>no</td>
                    <td>no</td>
                </tr>

                <tr>
                    <td>taxonomies</td>
                    <td>no</td>
                    <td>no</td>
                </tr>
            </tbody>
        </table>
    </section>
</main>
{{template "marketing-footer" .}}
{{end}}