+1
-4
src/app/series/[seriesId]/page.js
+1
-4
src/app/series/[seriesId]/page.js
+5
-8
src/app/works/[workId]/chapters/[chapterId]/page.js
+5
-8
src/app/works/[workId]/chapters/[chapterId]/page.js
···
5
5
// read route params
6
6
const { workId, chapterId } = await params
7
7
const work = await getWork({workId: workId, chapterId: chapterId})
8
+
const parentWork = await getWork({workId: workId})
8
9
const authors = work.authors.map((a) => {
9
10
if (a.anonymous) {
10
11
return "Anonymous"
···
17
18
const fandoms = work.fandoms
18
19
const fandomString = fandoms.length > 4 ? fandoms.slice(0, 4).join(", ")+" (+"+(fandoms.length - 4)+")" : (fandoms.length > 1 ? fandoms.slice(0, -1).join(", ")+" & "+fandoms.slice(-1)[0] : fandoms[0])
19
20
const title = `${work.title} by ${authorString}, Chapter ${work.chapterInfo.index}${work.chapterInfo.name ? ": "+work.chapterInfo.name : ''} - ${fandomString}`
20
-
const summary = work.chapterInfo && work.chapterInfo.summary ? work.chapterInfo.summary : work.summary
21
+
const summary = work.chapterInfo && work.chapterInfo.summary ? work.chapterInfo.summary : parentWork.summary
21
22
const summaryDOM = new DOM(summary, {decodeEntities: true});
23
+
console.log(summary)
22
24
const description = summaryDOM.innerHTML.replace(/\<br(?: \/)?\>/g, "\n").replace(
23
25
/(<([^>]+)>)/ig,
24
26
"",
···
28
30
return {
29
31
title: title,
30
32
description: description,
31
-
metadataBase: new URL('https://'+process.env.DOMAIN),
32
-
openGraph: {
33
-
description: description
34
-
}
33
+
metadataBase: new URL('https://'+process.env.DOMAIN)
35
34
}
36
35
}
37
36
38
37
export default async function Page({ params, searchParams }) {
39
38
const { workId, chapterId } = await params
40
39
return (
41
-
<div dangerouslySetInnerHTML={{__html: `<script type="text/javascript">
42
-
window.location.replace("https://archiveofourown.org/works/${workId}/chapters/${chapterId}");
43
-
</script>`}}></div>
40
+
<div></div>
44
41
)
45
42
}
+1
-4
src/app/works/[workId]/page.js
+1
-4
src/app/works/[workId]/page.js