
ืฉืคื ๐ฎ๐ฑ ืขืืจืืช
ืชืืขืื
ืืชืืืช ืขืืืื
ืชืฆืืจื
ืฉืืืืฉ
Add Comments to Your Eleventy (11ty) Site
ืืืื ืืกืคืจืืื ืืจืฉืืืช ืฉื Eleventy (11ty) ืขืืืจ FastComments.
ืืืืข ืชืืืืืช ืืืืช, ืฆ'ืื ืืืืื'ืืื ืืืืงืืจืืช ืืืชืจ Eleventy (11ty) ืฉืื.
ืืืืจ
ืืืืื ืืื 
ืืื ืืจืืืช ืื shortcode ื-flow ืฉืจืฆืื ืืืืคื ืืงืืื ืืื ืืื ื ื ืืฆืืืืจื demo, ืฉืืคื ืืช ืืืืืจ ืืืจืฅ:
cd example
npm install
npm start
ืืื ืจืืื ืืฉ ืขืืื ืืฉืื ืชืืช example/src/pages/ ืฉืชืืื ืืืขืชืืง ืืฉืืจืืช ืืืชืจ Eleventy ืฉืื.
ืืชืืื ืืืืจื 
ืืืกืฃ ืืช ืืชืืกืฃ ืืงืืืฅ ืืชืฆืืจื ืฉื Eleventy (.eleventy.js ืื 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" ืึพtenant ID ืฉื FastComments ืฉืื.
ืฉืืจืืงืืืื 
| ืงืื ืืงืืฆืจ | ืชืืืืจ |
|---|---|
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:
shortcodes: ['fastcomments', 'fastcommentsCommentCount'],
// ืืืกืฃ ืงืืืืืช ืืื ืฉื shortcode ืจืฉืื (ืืืฉื "fc" -> "fcFastcomments"):
prefix: 'fc'
});
ืฉืืืืฉ ืืื ื (ืืื ืืชืืกืฃ) 
ืื shortcode ืืืืฆื ืื ืืคืื ืงืฆืื ืขืฆืืืืช ืฉืืืืืจื ืืช ืืืจืืืช ื-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 ืืงืืืช ืื ืืืืช ืืชืจืืื.