FastComments.com
Here you can edit and run the code snippet from our documentation.
Example Code Snippet "在 HTTP val 中的評論小工具"
/** @jsxImportSource npm:hono@4/jsx */ import { Hono } from "npm:hono@4"; const app = new Hono(); app.get("/:slug", (c) => { const slug = c.req.param("slug"); const url = new URL(c.req.path, c.req.url).toString(); const config = JSON.stringify({ tenantId: "demo", urlId: slug, url, }); return c.html( <html> <body> <h1>{slug}</h1> <div id="fastcomments-widget"></div> <script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script> <script dangerouslySetInnerHTML={{ __html: `window.FastCommentsUI(document.getElementById("fastcomments-widget"), ${config});`, }} /> </body> </html>, ); }); export default app.fetch;
Result