aanthonymax 7 달 전
부모
커밋
64c8c14737
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      www/blog/_posts/2024-12-07-how-to-share-components-between-sites.md

+ 2 - 2
www/blog/_posts/2024-12-07-how-to-share-components-between-sites.md

@@ -193,7 +193,7 @@ const expressRouter = express.Router();
 const path = require("path");
 
 const buttonController = (req, res) => {
-  res.sendFile(path.join(__dirname, "../test.html"));
+  res.sendFile(path.join(__dirname, "../button.html"));
 };
 
 expressRouter.use("/getButton", buttonController);
@@ -250,7 +250,7 @@ We use method 1, since index.html is the default on our sites.
     <script src="https://unpkg.com/hmpl-js/dist/hmpl.min.js"></script>
     <script>
       const templateFn = hmpl.compile(
-        `<div id="wrapper">{{ src: "https://.../api/getButton" }}</div>`
+        `<div id="wrapper">{% raw %}{{ src: "https://.../api/getButton" }}{% endraw %}</div>`
       );
       const btnWrapper = templateFn().response;
       document.body.append(btnWrapper);