diff --git a/src/components/ArticleList.astro b/src/components/ArticleList.astro new file mode 100644 index 0000000..f67a2ae --- /dev/null +++ b/src/components/ArticleList.astro @@ -0,0 +1,19 @@ +--- +const { posts, displayDate = false, placeholder = false } = Astro.props; +--- +
+ {posts.map((post) => ( +

+ {displayDate && {new Date(post.data.pubDate).toISOString().split('T')[0]}} + {post.data.title} +

+ ))} + + {placeholder && posts.length === 0 && ( + <> +

+ No posts here yet +

+ + )} +
\ No newline at end of file diff --git a/src/components/Comments.astro b/src/components/Comments.astro index c0c25bd..7ab4a69 100644 --- a/src/components/Comments.astro +++ b/src/components/Comments.astro @@ -1,6 +1,7 @@ --- import {siteConfig} from "../config"; import FediverseComments from "./helper/comments/Fediverse.astro"; +import HatsuComments from "./helper/comments/Hatsu.astro"; const method = siteConfig.comments.type const ArtalkConfig = siteConfig.comments.artalk @@ -52,3 +53,4 @@ let { path='/' } = Astro.props; {(method === 'fediverse' && !FediverseConfig.renderOnServer ) && } {(method === 'fediverse' && FediverseConfig.renderOnServer ) &&

Loading comments...

} +{method === 'hatsu' && } \ No newline at end of file diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro new file mode 100644 index 0000000..7bcb4bc --- /dev/null +++ b/src/components/Navbar.astro @@ -0,0 +1,9 @@ +--- +import {siteConfig} from "../config"; +const navBarItems = siteConfig.navBarItems +--- + \ No newline at end of file diff --git a/src/components/Statistics.astro b/src/components/Statistics.astro new file mode 100644 index 0000000..bc9444e --- /dev/null +++ b/src/components/Statistics.astro @@ -0,0 +1,35 @@ +--- +import {siteConfig} from "../config"; +const noscript = siteConfig.noClientJavaScript +const statisticsType = siteConfig.siteAnalytics.type +const umamiConfig = siteConfig.siteAnalytics.umami +const goatCounterConfig = siteConfig.siteAnalytics.goatcounter +--- +{statisticsType === 'umami' && ( + +)} + +{statisticsEnabled && statisticsType === 'goatcounter' && ( + <> + {noscript ? ( + Analytics + ) : ( + <> + + + + )} + +)} \ No newline at end of file diff --git a/src/components/helper/comments/Hatsu.astro b/src/components/helper/comments/Hatsu.astro new file mode 100644 index 0000000..42d5aa4 --- /dev/null +++ b/src/components/helper/comments/Hatsu.astro @@ -0,0 +1,494 @@ +--- +import {siteConfig} from "../../../config"; +const hatsuHost = `https://${siteConfig.comments.hatsu.instanceDomain}` +const {origin, pathname} = new URL(Astro.url) +const url = new URL(pathname, origin).href + +import { transform } from "ultrahtml"; +import sanitize from "ultrahtml/transformers/sanitize"; +--- +
+

Comments by Hatsu

+

+
+ +
+
+ + \ No newline at end of file diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index d7ccb74..055801a 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -8,6 +8,8 @@ import Meta from "../components/helper/head/Meta.astro"; import { siteConfig } from "../config"; import Logo from '../assets/mercury.svg' +import Statistics from "../components/Statistics.astro"; +import Navbar from "../components/Navbar.astro"; interface Props { title: string; @@ -20,9 +22,6 @@ interface Props { const noscript = siteConfig.noClientJavaScript const statisticsEnabled = siteConfig.siteAnalytics.enabled -const statisticsType = siteConfig.siteAnalytics.type -const umamiConfig = siteConfig.siteAnalytics.umami -const goatCounterConfig = siteConfig.siteAnalytics.goatcounter const defaultTitle = siteConfig.title const formattedRootPath = defaultTitle.toLowerCase().replace(/\s+/g, '-'); @@ -31,7 +30,6 @@ const path = formattedRootPath + (relativePath === '/' ? '' : relativePath) const pageTitle = (relativePath === '/' ? defaultTitle : `${Astro.props.title} - ${defaultTitle}`) -const navBarItems = siteConfig.navBarItems const customFooter = siteConfig.customFooter const nekoType = siteConfig.neko?.type @@ -54,13 +52,7 @@ const { title = pageTitle, author = siteConfig.defaultAuthor.name,description =
{path}
- - - +
@@ -80,33 +72,7 @@ const { title = pageTitle, author = siteConfig.defaultAuthor.name,description =

Powered by mercury

- {statisticsEnabled && statisticsType === 'umami' && ( - - )} - {statisticsEnabled && statisticsType === 'goatcounter' && ( - <> - {noscript ? ( - Analytics - ) : ( - <> - - - - )} - - )} + {statisticsEnabled && } { (siteConfig.neko.enabled && !noscript) && <>