云函数部署

Docker Compose

version: '3'
services:
  twikoo:
    image: imaegoo/twikoo
    container_name: twikoo
    restart: unless-stopped
    ports:
      - 8080:8080
    environment:
      TWIKOO_THROTTLE: 1000
    volumes:
      - ./data:/app/data

前端部署

<div id="tcomment"></div>
 
<script>
  const commentsContainer = document.getElementById("tcomment");
  if (commentsContainer) {
    const script = document.createElement("script");
    script.src = "https://cdn.staticfile.org/twikoo/1.6.32/twikoo.all.min.js";
    script.async = true;
    script.onload = () => {
      const initScript = document.createElement("script");
      initScript.innerHTML = `
            twikoo.init({
                envId: 'https://blog.songxingguo.com/twikoo',
                el: '#tcomment',
            });
        `;
      document.body.appendChild(initScript);
    };
    document.body.appendChild(script);
  }
</script>