COLUMN

sample

2023.12.102025.12.10 更新

sample

見出し1

サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。

All Mappings Fetch Test – Comment Embed Test

Embed Script Test – All Mappings Fetch

Simple Implementation

<script src="embed.js">
</script>

Automatically fetches all configured mappings from database

What It Does

  • Fetches ALL mappings
  • No configuration needed
  • Matches H2 elements automatically
  • One script for all pages

Introduction

This article explains the new features of the dynamic embed script. By omitting the data-article-ids attribute, you can automatically fetch all configured H2 section mappings.

This eliminates the need to manage article IDs on the media website side, and all mappings configured in the admin dashboard are automatically applied.

Key Features and Benefits

Main Advantages:

  • Simple Implementation: No need to manage article IDs
  • Flexibility: Changes reflected just by updating settings in admin dashboard
  • Auto-matching: Automatic insertion based on H2 element IDs
  • Backward Compatibility: Traditional article ID specification still works

How to Use

Step 1: Configure external element IDs in admin dashboard

  1. Open article detail page
  2. Enter external element ID for each H2 section (e.g., heading-intro)
  3. Save

Step 2: Add IDs to H2 elements on media website

<h2 id="heading-intro">Heading Text</h2>

Step 3: Add embed script

<script src="http://localhost:8000/embed.js"></script>

Technical Details

The script works as follows:

  1. Script is loaded
  2. Check for data-article-ids attribute
  3. If no attribute: GET /api/embed/config (fetch all mappings)
  4. If attribute present: GET /api/embed/config?article_ids=xxx
  5. Search for H2 elements on the page
  6. Insert iframes below matching H2 elements

Conclusion

The all mappings fetch mode makes embed script implementation even simpler. Media websites just need to add the script tag, and all expert comments configured in the admin dashboard are automatically displayed.

Open the console (F12) to see the script in action!

💻 Expected Console Output: [CommentEmbed] Initializing… [CommentEmbed] No data-article-ids attribute found. Will fetch all available mappings. [CommentEmbed] Fetching all available mappings (no article IDs specified) [CommentEmbed] Fetching mapping from: http://localhost:8000/api/embed/config [CommentEmbed] Mapping fetched successfully: 5 H2 section(s) found [CommentEmbed] Mapping details: { “heading-intro”: “673abc…”, “heading-features”: “673def…”, “heading-usage”: “673ghi…”, “heading-technical”: “674jkl…”, “heading-conclusion”: “674mno…” } [CommentEmbed] Iframe inserted for H2: heading-intro [CommentEmbed] Iframe inserted for H2: heading-features [CommentEmbed] Iframe inserted for H2: heading-usage [CommentEmbed] Iframe inserted for H2: heading-technical [CommentEmbed] Iframe inserted for H2: heading-conclusion [CommentEmbed] Processed 5 H2 sections, 0 not found [CommentEmbed] Initialized successfully

見出し2

サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。

houmu_admin

houmu_adminのアバター

※当社(株式会社WEBY)は直接債務整理のサービスを提供しておらず、債務整理の相談や依頼については紹介事務所へのリンク先で対応となるため、当サイトでは債務整理に関する個人の相談や質問にはお答えできません。
当サイトのコンテンツは事実に反しないよう尽力していますが、内容の正確性や信頼性、安全性を担保するものではありません。
債務整理の無料相談や依頼にお申し込みされる際は各弁護士事務所・司法書士事務所等の公式ホームページに記載されている内容をご確認いただき、自己判断していただけますようお願いいたします。
当サイトは株式会社WEBYと提携する企業のPR情報が含まれます。
当サイトで掲載しているコンテンツは個人および法人へ向けた情報提供が目的であり、債務整理を提供する事業者との契約代理や媒介、斡旋を助長するものではありません。

CONSULTATION

目次 ▼