FastComments.com

Add Comments With MemberSpace

FastComments๋ฅผ MemberSpace์™€ ๊ฒฐํ•ฉํ•˜๋ฉด ๋ฉค๋ฒ„ ์ „์šฉ ๋Œ“๊ธ€ ๊ธฐ๋Šฅ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์›ํ•  ๊ฒฝ์šฐ ์‚ฌ์šฉ์ž๊ฐ€ ๋กœ๊ทธ์ธํ•œ ์ƒํƒœ์—์„œ๋„ ์ต๋ช… ๋Œ“๊ธ€์„ ํ—ˆ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์‹ฌ์ง€์–ด ์‚ฌ์šฉ์ž์˜ ๋ฉค๋ฒ„์‹ญ์— ๋”ฐ๋ผ ๋งž์ถค ๋ฐฐ์ง€๋ฅผ ์„ค์ •ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค!

์ฝ”๋“œ Internal Link

์ž‘์€ ์ฝ”๋“œ ์Šค๋‹ˆํŽซ์œผ๋กœ FastComments์™€ MemberSpace๋ฅผ ์‰ฝ๊ฒŒ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

FastComments MemberSpace Snippet
Copy Copy
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5 (function () {
6 const tenantId = 'demo';
7 const ALLOW_ANON = false;
8 const LOGIN_URL = 'https://example.com/login';
9 const PLAN_DISPLAY_LABELS = {
10 'VIP Plan': 'VIP'
11 };
12 let lastInstance;
13
14 function tick() {
15 if (!window.MemberSpace) {
16 return setTimeout(tick, 100);
17 }
18 if (!window.FastCommentsUI) {
19 return setTimeout(tick, 100);
20 }
21 const target = document.getElementById('fastcomments-widget');
22 if (!target) {
23 return setTimeout(tick, 100);
24 }
25 const data = MemberSpace.getMemberInfo();
26 if (data.isLoggedIn && data.memberInfo) {
27 lastInstance = FastCommentsUI(target, {
28 tenantId: tenantId,
29 urlId: window.location.pathname,
30 simpleSSO: {
31 displayLabel: getDisplayLabel(data.memberInfo),
32 username: data.memberInfo.name,
33 email: data.memberInfo.email,
34 avatar: data.memberInfo.profileImageUrl
35 }
36 });
37 } else if (lastInstance) {
38 lastInstance.destroy();
39 lastInstance = FastCommentsUI(target, {
40 tenantId: tenantId,
41 urlId: window.location.pathname,
42 simpleSSO: getAnonSSOConfig()
43 });
44 }
45 }
46
47 function getAnonSSOConfig() {
48 if (ALLOW_ANON) {
49 return undefined;
50 }
51 return {
52 loginURL: LOGIN_URL
53 };
54 }
55
56 function getDisplayLabel(memberInfo) {
57 if (!memberInfo.memberships) {
58 return;
59 }
60 for (const membership of memberInfo.memberships) {
61 const label = PLAN_DISPLAY_LABELS[membership.name];
62 if (label) {
63 return label
64 }
65 }
66 }
67
68 tick();
69 })();
70</script>
71

์‚ฌ์šฉ์ž๊ฐ€ MemberStack์„ ํ†ตํ•ด ๋กœ๊ทธ์ธํ•œ ์ƒํƒœ์—์„œ ๊ท€ํ•˜์˜ ์‚ฌ์ดํŠธ๋‚˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋ฐฉ๋ฌธํ•˜๋ฉด, ์ž๋™์œผ๋กœ FastComments์— ๋กœ๊ทธ์ธ๋˜๊ณ  ๋Œ“๊ธ€์€ Verified๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

๋˜ํ•œ ์œ„์˜ ์˜ˆ์—์„œ VIP Plan์ด๋ผ๋Š” ๊ตฌ๋… ํ”Œ๋žœ์ด ์žˆ์œผ๋ฉด ์‚ฌ์šฉ์ž ์ด๋ฆ„ ์˜†์— VIP ๋ฐฐ์ง€๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ์ œ๋ฅผ ํŽธ์ง‘ํ•˜์—ฌ ๋” ๋งŽ์€ ํ”Œ๋žœ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์งˆ๋ฌธ์ด ์žˆ์œผ์‹œ๋ฉด ์ง€์›ํŒ€์— ๋ฌธ์˜ํ•˜์„ธ์š”.

์ต๋ช… ๋Œ“๊ธ€ ํ—ˆ์šฉ

์ต๋ช… ๋Œ“๊ธ€๋„ ํ—ˆ์šฉํ•˜๋ ค๋ฉด ALLOW_ANON์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด true๋กœ ์„ค์ •ํ•˜์„ธ์š”:

const ALLOW_ANON = true;

๋˜ํ•œ https://example.com/login์„ ์‚ฌ์šฉ์ž๊ฐ€ Login ๋ฒ„ํŠผ์„ ํด๋ฆญํ•  ๋•Œ ์ด๋™ํ•  ์œ„์น˜๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์„ ์žŠ์ง€ ๋งˆ์„ธ์š”:

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํšŒ์› ์‚ฌ์ดํŠธ์— ๋กœ๊ทธ์ธํ•˜์ง€ ์•Š์€ ์‚ฌ์šฉ์ž๋„ ์ด๋ฆ„๊ณผ ์ด๋ฉ”์ผ์„ ์ž…๋ ฅํ•˜์—ฌ ๋Œ“๊ธ€์„ ๋‹ฌ ์ˆ˜ ์žˆ๋Š” ์˜ต์…˜์ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.

๋งž์ถค ์„ค์ • Internal Link

FastComments๋Š” ๊ท€ํ•˜์˜ ์‚ฌ์ดํŠธ์— ๋งž๊ฒŒ ๋งž์ถค ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค๊ณ„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์‚ฌ์šฉ์ž ์ •์˜ ์Šคํƒ€์ผ์„ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ๊ตฌ์„ฑ์„ ์กฐ์ •ํ•˜๋ ค๋ฉด ์‚ฌ์šฉ์ž ์ •์˜ ๋ฌธ์„œ๋ฅผ ํ™•์ธํ•˜์—ฌ ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด์„ธ์š”.