Skip to content

Commit 66977aa

Browse files
doc: Add a sample post to show the usage of tags (#133)
1 parent 6402993 commit 66977aa

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

blog_test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,30 @@ Deno.test("posts/ 中文", async () => {
185185
assertStringIncludes(body, `<p>你好,世界!`);
186186
});
187187

188+
Deno.test("posts/ sixth", async () => {
189+
const resp = await testHandler(new Request("https://blog.deno.dev/sixth"));
190+
assert(resp);
191+
assertEquals(resp.status, 200);
192+
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
193+
const body = await resp.text();
194+
assertStringIncludes(
195+
body,
196+
`<a class="text-bluegray-500 font-bold" href="/?tag=sample">#sample</a>`,
197+
);
198+
assertStringIncludes(
199+
body,
200+
`<a class="text-bluegray-500 font-bold" href="/?tag=tags">#tags</a>`,
201+
);
202+
assertStringIncludes(body, `<html lang="en-GB">`);
203+
assertStringIncludes(
204+
body,
205+
`<link rel="canonical" href="https://blog.deno.dev/sixth" />`,
206+
);
207+
assertStringIncludes(body, `Sixth post`);
208+
assertStringIncludes(body, `<time dateTime="2023-08-17T00:00:00.000Z">`);
209+
assertStringIncludes(body, `Tags make it easier for readers`);
210+
});
211+
188212
Deno.test("posts/ trailing slash redirects", async () => {
189213
const resp = await testHandler(new Request("https://blog.deno.dev/second/"));
190214
assert(resp);

testdata/posts/sixth.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Sixth post
3+
author: CUSTOM AUTHOR NAME
4+
publish_date: 2023-08-17
5+
snippet: Some snippet appears in main page.
6+
abstract: This is the sixth post showcasing math rendering
7+
summary: Sort summary
8+
description: A description to this post
9+
tags: ["sample", "tags"]
10+
allow_iframes: false
11+
disable_html_sanitization: false
12+
render_math: true
13+
---
14+
15+
# Tags
16+
17+
- Tags make it easier for readers to find the desired article.
18+
19+
```markdown
20+
---
21+
tags: ["deno", "tags"]
22+
---
23+
```
24+
25+
or
26+
27+
```markdown
28+
---
29+
tags:
30+
- deno
31+
- tags
32+
---
33+
```

0 commit comments

Comments
 (0)