Skip to content

Commit

Permalink
doc: Add a sample post to show the usage of tags (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshida-ryuhei authored Aug 22, 2023
1 parent 6402993 commit 66977aa
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
24 changes: 24 additions & 0 deletions blog_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,30 @@ Deno.test("posts/ 中文", async () => {
assertStringIncludes(body, `<p>你好,世界!`);
});

Deno.test("posts/ sixth", async () => {
const resp = await testHandler(new Request("https://blog.deno.dev/sixth"));
assert(resp);
assertEquals(resp.status, 200);
assertEquals(resp.headers.get("content-type"), "text/html; charset=utf-8");
const body = await resp.text();
assertStringIncludes(
body,
`<a class="text-bluegray-500 font-bold" href="/?tag=sample">#sample</a>`,
);
assertStringIncludes(
body,
`<a class="text-bluegray-500 font-bold" href="/?tag=tags">#tags</a>`,
);
assertStringIncludes(body, `<html lang="en-GB">`);
assertStringIncludes(
body,
`<link rel="canonical" href="https://blog.deno.dev/sixth" />`,
);
assertStringIncludes(body, `Sixth post`);
assertStringIncludes(body, `<time dateTime="2023-08-17T00:00:00.000Z">`);
assertStringIncludes(body, `Tags make it easier for readers`);
});

Deno.test("posts/ trailing slash redirects", async () => {
const resp = await testHandler(new Request("https://blog.deno.dev/second/"));
assert(resp);
Expand Down
33 changes: 33 additions & 0 deletions testdata/posts/sixth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Sixth post
author: CUSTOM AUTHOR NAME
publish_date: 2023-08-17
snippet: Some snippet appears in main page.
abstract: This is the sixth post showcasing math rendering
summary: Sort summary
description: A description to this post
tags: ["sample", "tags"]
allow_iframes: false
disable_html_sanitization: false
render_math: true
---

# Tags

- Tags make it easier for readers to find the desired article.

```markdown
---
tags: ["deno", "tags"]
---
```

or

```markdown
---
tags:
- deno
- tags
---
```

0 comments on commit 66977aa

Please sign in to comment.