Replies: 4 comments 3 replies
-
|
waline https://waline.js.org/ |
Beta Was this translation helpful? Give feedback.
-
|
You can also write something simple yourself. You don't need a database, just normal free hosting where the data will be written. |
Beta Was this translation helpful? Give feedback.
-
|
Before i used Remark42. It worked before, so i will give it a try. <script>
var remark_config = {
host: "REMARK_URL",
site_id: "YOUR_SITE_ID",
}
</script>and this <script>!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);</script>I have the following code, but get this error in the browser .vitepress/theme/index.mjs import Layout from "./Layout.vue";
export default {
Layout,
};.vitepress/theme/Layout.vue <!-- .vitepress/theme/Layout.vue -->
<script setup>
import DefaultTheme from "vitepress/theme";
import Comments from "./components/Remark42Comments.vue";
const { Layout } = DefaultTheme;
</script>
<template>
<Layout>
<template #doc-after>
<Comments />
</template>
</Layout>
</template>.vitepress/theme/components/Remark42Comments.vue <script setup>
import { useData } from "vitepress";
const remark_config = {
host: "https://comments.myDomain.com",
site_id: "remark",
};
const { title } = useData();
!(function (e, n) {
for (var o = 0; o < e.length; o++) {
var r = n.createElement("script"),
c = ".js",
d = n.head || n.body;
"noModule" in r ? ((r.type = "module"), (c = ".mjs")) : (r.async = !0),
(r.defer = !0),
(r.src = remark_config.host + "/web/" + e[o] + c),
d.appendChild(r);
}
})(remark_config.components || ["embed"], document);
</script>
<template>
<div id="remark42" ref="remark42" :key="title"></div>
</template>
|
Beta Was this translation helpful? Give feedback.
-
|
I decided on Commentario. The following example shows how to implement Commentario using VitePress. The code was created with the help of AI and has been tested. .vitepress/composables/useComentario.tsimport { useRoute } from "vitepress";
const COMENTARIO_URL = "https://comments.yousite.com";
export function useComentario() {
const route = useRoute();
const getTheme = () =>
document.documentElement.classList.contains("dark") ? "dark" : "light";
const initialize = () => {
if (typeof window === "undefined") return;
// Set initial theme BEFORE loading script
const commentsEl = document.querySelector("comentario-comments");
if (commentsEl) {
commentsEl.setAttribute("theme", getTheme());
}
// Load Comentario script
const script = document.createElement("script");
script.src = `${COMENTARIO_URL}/comentario.js`;
script.setAttribute("data-url", window.location.origin + route.path);
script.setAttribute("data-page-id", route.path);
script.setAttribute("data-css-override", "true");
script.async = true;
document.head.appendChild(script);
// Watch for VitePress theme changes
const observer = new MutationObserver(() => {
const comments = document.querySelector("comentario-comments");
if (comments) comments.setAttribute("theme", getTheme());
});
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"],
});
};
return { initialize };
}.vitepress/theme/index.tsimport { h } from "vue";
import DefaultTheme from "vitepress/theme";
import Comentario from "../components/Comentario.vue";
import type { Theme } from "vitepress";
import "./custom.css";
export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
"doc-after": () => h(Comentario),
"page-bottom": () => h(Comentario),
});
},
} satisfies Theme;.vitepress/components/Comentario.vue<template>
<div class="comentario-section vp-doc">
<h2 id="comments">Comments</h2>
<comentario-comments></comentario-comments>
</div>
</template>
<script setup>
import { onMounted } from "vue";
import { useComentario } from "../composables/useComentario";
onMounted(() => {
useComentario().initialize();
});
</script> |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
which comment system do you use, besides giscus?
I am looking for system which supports social login, because not everyone has a GitHub account.
Beta Was this translation helpful? Give feedback.
All reactions