-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ability to override titles of specific pages (#32)
- Loading branch information
Showing
31 changed files
with
248 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ jobs: | |
restore-keys: chrome-1022525-${{ runner.os }}- | ||
|
||
- name: Install Chromium (Unix) | ||
run: PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/[email protected]/install.ts | ||
run: PUPPETEER_PRODUCT=chrome deno run -A https://deno.land/x/[email protected]/install.ts | ||
|
||
- name: Run tests | ||
run: deno test -A --coverage=cov/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,4 @@ | |
.env.test.local | ||
.env.production.local | ||
.env.local | ||
cov_profile | ||
cov.lcov | ||
cov | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,4 @@ | ||
export const safelist = [ | ||
"list-disc", | ||
"list-decimal", | ||
"max-w-screen-md", | ||
"px-4", | ||
"pt-16", | ||
"mx-auto", | ||
"pb-16", | ||
"flex", | ||
"justify-between", | ||
"hover:underline", | ||
"mt-8", | ||
"py-4", | ||
"border-t", | ||
"border-gray-200", | ||
"sm:col-span-2", | ||
"text-3xl", | ||
"text-gray-900", | ||
"font-bold", | ||
"text-gray-500", | ||
"mr-1", | ||
"ml-1", | ||
"border", | ||
"border-gray-300", | ||
"py-1", | ||
"px-2", | ||
"rounded", | ||
"inline-block", | ||
"hover:bg-gray-300", | ||
"space-x-2", | ||
"mb-4", | ||
"markdown-body", | ||
"flex-grow", | ||
"sticky", | ||
"top-0", | ||
"w-full", | ||
"z-10", | ||
"items-center", | ||
"text-5xl", | ||
"lg:hidden", | ||
"cursor-pointer", | ||
"z-20", | ||
"block", | ||
"h-1", | ||
"w-6", | ||
"bg-black", | ||
"transform", | ||
"rotate-45", | ||
"my-1", | ||
"opacity-0", | ||
"-rotate-45", | ||
"fixed", | ||
"left-0", | ||
"overflow-hidden", | ||
"transition-max-height", | ||
"duration-500", | ||
"lg:relative", | ||
"max-h-screen", | ||
"bg-gray-300", | ||
"max-h-0", | ||
"lg:max-h-full", | ||
"flex-col", | ||
"lg:flex-row", | ||
"justify-center", | ||
"gap-4", | ||
"mx-4", | ||
"my-6", | ||
"flex-wrap", | ||
"p-2", | ||
"text-black-900", | ||
"text-black-600", | ||
"py-2", | ||
"ml-auto", | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { createHandler } from "../deps.ts"; | ||
import manifest from "./custom_titles_fixture/fresh.gen.ts"; | ||
import { blogPlugin } from "../src/plugin/blog.ts"; | ||
import { DOMParser } from "./test_deps.ts"; | ||
import { assertTitle } from "./test_utils.ts"; | ||
import blogConfig from "./custom_titles_fixture/blog.config.ts"; | ||
|
||
Deno.test("Tag page title override", async () => { | ||
const handler = await createHandler(manifest, { | ||
plugins: [blogPlugin(blogConfig)], | ||
}); | ||
const resp = await handler( | ||
new Request("http://127.0.0.1/archive/placeholder"), | ||
); | ||
const body = await resp.text(); | ||
const doc = new DOMParser().parseFromString(body, "text/html")!; | ||
assertTitle(doc, "Tagged: The Untold Stories"); | ||
}); | ||
|
||
Deno.test("Author page title override", async () => { | ||
const handler = await createHandler(manifest, { | ||
plugins: [blogPlugin(blogConfig)], | ||
}); | ||
const resp = await handler( | ||
new Request("http://127.0.0.1/author/reed-von-redwitz"), | ||
); | ||
const body = await resp.text(); | ||
const doc = new DOMParser().parseFromString(body, "text/html")!; | ||
assertTitle(doc, "Author's Saga"); | ||
}); | ||
|
||
Deno.test("Index page title override", async () => { | ||
const handler = await createHandler(manifest, { | ||
plugins: [blogPlugin(blogConfig)], | ||
}); | ||
const resp = await handler(new Request("http://127.0.0.1/")); | ||
const body = await resp.text(); | ||
const doc = new DOMParser().parseFromString(body, "text/html")!; | ||
assertTitle(doc, "Welcome to the Jungle"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { BlogOptions } from "../../mod.ts"; | ||
|
||
export default { | ||
title: "Demo Blog", | ||
navbarItems: { | ||
Home: "/", | ||
Archive: "/archive", | ||
}, | ||
rootPath: import.meta.url, | ||
pageOptions: { | ||
"archive/[tag]": { | ||
titleOverride: "Tagged: The Untold Stories", | ||
suppressEnding: true, | ||
}, | ||
"author/[author]": { | ||
titleOverride: "Author's Saga", | ||
suppressEnding: true, | ||
}, | ||
"index": { | ||
titleOverride: "Welcome to the Jungle", | ||
suppressEnding: true, | ||
}, | ||
}, | ||
} satisfies BlogOptions; |
Oops, something went wrong.