
์ธ์ด ๐ฐ๐ท ํ๊ตญ์ด
๋ฌธ์
์์ํ๊ธฐ
์ค์
์ฌ์ฉ๋ฒ
Add Comments to Your Eleventy (11ty) Site
์ด๊ฒ์ FastComments์ฉ ๊ณต์ Eleventy (11ty) ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค.
๊ทํ์ Eleventy (11ty) ์ฌ์ดํธ์ ์ค์๊ฐ ๋๊ธ, ์ฑํ ๋ฐ ๋ฆฌ๋ทฐ ์์ ฏ์ ์๋ฒ ๋ํ์ธ์.
์ ์ฅ์
๋ผ์ด๋ธ ์ผ์ผ์ด์ค 
๋ชจ๋ ์์ฝ๋์ ํ๋ก์ฐ๊ฐ ๊ณต์ฉ demo ํ
๋ํธ์ ๋ํด ๋ก์ปฌ์์ ์คํ๋๋ ๋ชจ์ต์ ๋ณด๋ ค๋ฉด, ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ํด๋ก ํ๊ณ ๋ค์์ ์คํํ์ธ์:
cd example
npm install
npm start
๊ฐ ์ปดํฌ๋ํธ๋ example/src/pages/ ์๋์ ์์ฒด ํ์ด์ง๊ฐ ์์ผ๋ฉฐ, ์ด๋ฅผ ๊ทธ๋๋ก ๋ณต์ฌํ์ฌ ์์ ์ Eleventy ์ฌ์ดํธ์ ๋ถ์ฌ๋ฃ์ ์ ์์ต๋๋ค.
๋น ๋ฅธ ์์ 
Eleventy ๊ตฌ์ฑ ํ์ผ(.eleventy.js or eleventy.config.js)์ ํ๋ฌ๊ทธ์ธ์ ๋ฑ๋กํ์ธ์:
const { fastcommentsPlugin } = require('fastcomments-11ty');
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(fastcommentsPlugin);
};
๋๋ ESM ์ฌ์ฉ ์:
import { fastcommentsPlugin } from 'fastcomments-11ty';
export default function(eleventyConfig) {
eleventyConfig.addPlugin(fastcommentsPlugin);
}
๊ทธ๋ฐ ๋ค์ ํ
ํ๋ฆฟ์์ ์์ฝ๋๋ฅผ ์ฌ์ฉํ์ธ์. Nunjucks (.njk)์์๋:
{% fastcomments { tenantId: "demo" } %}
Liquid (.liquid)์์๋:
{% fastcomments tenantId: "demo" %}
"demo"๋ฅผ ๋ณธ์ธ์ FastComments ํ
๋ํธ ID๋ก ๋ณ๊ฒฝํ์ธ์.
์์ฝ๋ 
| ์์ฝ๋ | ์ค๋ช |
|---|---|
fastcomments |
๋ต๊ธ, ํฌํ ๋ฑ ๋ค์ํ ๊ธฐ๋ฅ์ ๊ฐ์ถ ๋๊ธ ์์ ฏ |
fastcommentsCommentCount |
ํ์ด์ง์ ๋๊ธ ์๋ฅผ ํ์ํฉ๋๋ค. |
fastcommentsImageChat |
์ด๋ฏธ์ง ์ฃผ์ ๋๊ธ |
fastcommentsLiveChat |
๋ผ์ด๋ธ ์ฑํ ์์ ฏ |
fastcommentsCollabChat |
ํ์ ์ธ๋ผ์ธ ๋๊ธ |
fastcommentsRecentComments |
์ฌ์ดํธ ์ ์ฒด์ ์ต๊ทผ ๋๊ธ |
fastcommentsRecentDiscussions |
์ต๊ทผ ํ์ฑ ํ ๋ก ์ค๋ ๋ |
fastcommentsReviewsSummary |
๋ณ์ ๊ธฐ๋ฐ ๋ฆฌ๋ทฐ ์์ฝ |
fastcommentsTopPages |
๊ฐ์ฅ ๋ง์ด ๋ ผ์๋ ํ์ด์ง |
fastcommentsUserActivityFeed |
์ฌ์ฉ์ ํ๋ ํผ๋ |
์์
{# ํ
์คํธ์ ํจ๊ป ์ธ๋ผ์ธ์ผ๋ก ํ์๋๋ ๋๊ธ ์ #}
This page has {% fastcommentsCommentCount { tenantId: "demo" } %} comments.
{# ๋ผ์ด๋ธ ์ฑํ
#}
{% fastcommentsLiveChat { tenantId: "demo" } %}
{# ํ์
์ฑํ
โ CSS ์ ํ์๋ก ์ฝํ
์ธ ์์๋ฅผ ๋์์ผ๋ก ์ง์ #}
<article id="post-body">
<p>Highlight me to leave a comment.</p>
</article>
{% fastcommentsCollabChat { tenantId: "demo", target: "#post-body" } %}
{# ์ด๋ฏธ์ง ์ฑํ
โ CSS ์ ํ์๋ก ์ด๋ฏธ์ง ์์๋ฅผ ๋์์ผ๋ก ์ง์ #}
<img id="hero" src="/hero.jpg" alt="Hero image" />
{% fastcommentsImageChat { tenantId: "demo", target: "#hero" } %}
{# ๋ฆฌ๋ทฐ ์์ฝ #}
{% fastcommentsReviewsSummary { tenantId: "demo" } %}
{# ์ฌ์ฉ์ ํ๋ ํผ๋ #}
{% fastcommentsUserActivityFeed { tenantId: "demo", userId: "demo:demo-user" } %}
ํ๋ฌ๊ทธ์ธ ์ต์

eleventyConfig.addPlugin(fastcommentsPlugin, {
// ๋จ์ถ ์ฝ๋์ ํ์ ์งํฉ๋ง ๋ฑ๋กํฉ๋๋ค:
shortcodes: ['fastcomments', 'fastcommentsCommentCount'],
// ๋ฑ๋ก๋ ๋ชจ๋ ๋จ์ถ ์ฝ๋ ์ด๋ฆ์ ์ ๋์ฌ๋ฅผ ์ถ๊ฐํฉ๋๋ค (์: "fc" -> "fcFastcomments"):
prefix: 'fc'
});
์๋ ์ฌ์ฉ(ํ๋ฌ๊ทธ์ธ ์์ด) 
๊ฐ ์์ฝ๋๋ HTML ๋ฌธ์์ด์ ๋ฐํํ๋ ๋ ๋ฆฝ ์คํํ ํจ์๋ก๋ ๋ด๋ณด๋ด์ง๋๋ค:
const { fastcomments, commentCount } = require('fastcomments-11ty');
eleventyConfig.addShortcode('comments', fastcomments);
eleventyConfig.addShortcode('commentCount', commentCount);
์์ ํ๋ก์ ํธ 
์๋ํ๋ ๋ฐ๋ชจ๊ฐ example/ ๋๋ ํ ๋ฆฌ์ ํฌํจ๋์ด ์์ต๋๋ค:
cd example && npm install && npm start
์ ์ง๋ณด์ ์ํ 
์ด ์ปดํฌ๋ํธ๋ค์ ๋น์ฌ์ ํต์ฌ VanillaJS ์ปดํฌ๋ํธ๋ค์ ๊ฐ์ธ๋ ๋ํผ์ ๋๋ค. ์ฐ๋ฆฌ๋ ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋ฐฐํฌํ์ง ์๊ณ ๋ ์ด๋ฌํ ์ปดํฌ๋ํธ๋ค์ ์๋์ผ๋ก ์ ๋ฐ์ดํธ(๋ฒ๊ทธ ์์ , ๊ธฐ๋ฅ ์ถ๊ฐ)ํ ์ ์์ผ๋ฏ๋ก, ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๋น๋ถ๊ฐ ๋ฐฐํฌ๋์ง ์์ ์ ์๋ค๊ณ ํด์ FastComments๊ฐ ํ๋ฐํ ๊ฐ๋ฐ๋๊ณ ์์ง ์๋ค๋ ๋ป์ ์๋๋๋ค! ์ ๋ฐ์ดํธ๋ ๋น์ฌ ๋ธ๋ก๊ทธ์์ ํ์ธํ์ธ์. ํธํ์ ๊นจ๋ API ๋ณ๊ฒฝ์ด๋ ๊ธฐ๋ฅ์ ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ฒ์ ์ด ์ฌ๋ ค์ง์ง ์๋ ํ ๊ธฐ๋ฐ ์ฝ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ ๋ ๋ฐฐํฌ๋์ง ์์ต๋๋ค.
๋์์ด ํ์ํ์ ๊ฐ์?
Eleventy (11ty) ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ด๋ จํ์ฌ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ฑฐ๋ ์ง๋ฌธ์ด ์์ผ์๋ฉด:
๊ธฐ์ฌ
๊ธฐ์ฌ๋ฅผ ํ์ํฉ๋๋ค! ๊ธฐ์ฌ ์ง์นจ์ GitHub ์ ์ฅ์๋ฅผ ๋ฐฉ๋ฌธํ์ธ์.