aboutsummaryrefslogtreecommitdiffhomepage
path: root/astro.config.mjs
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-06-25 13:56:02 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-06-25 13:56:02 +0900
commitc40643a98487d0dbe4d9b89877fb98249055c31d (patch)
treed77b47696c4b5f639328cc8da8a9af9a240c3a91 /astro.config.mjs
parentfdb543c2ec991906f8bafc752a4a5e24aa07e349 (diff)
全ページにSNS共有ボタンと見出しアンカーリンクを追加
- SocialShare コンポーネント: X/Facebook/LINE 共有ボタンを 各ページフッターに表示 - Footer コンポーネントを上書きして SocialShare を組み込み - 見出し(h2/h3)にホバーでコピー可能なアンカーリンクを追加 - custom.css にアンカーリンクのスタイルを追加
Diffstat (limited to 'astro.config.mjs')
-rw-r--r--astro.config.mjs6
1 files changed, 6 insertions, 0 deletions
diff --git a/astro.config.mjs b/astro.config.mjs
index 8b38f9c..6f7f212 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -225,12 +225,18 @@ export default defineConfig({
{
tag: "script",
content:
+ "document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('.sl-markdown-content h2[id], .sl-markdown-content h3[id]').forEach(h => { const a = document.createElement('a'); a.href = '#' + h.id; a.className = 'heading-anchor'; a.innerHTML = '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></svg>'; a.title = 'この見出しへのリンクをコピー'; a.addEventListener('click', e => { e.preventDefault(); const url = location.origin + location.pathname + '#' + h.id; navigator.clipboard.writeText(url).then(() => { a.classList.add('copied'); setTimeout(() => a.classList.remove('copied'), 1500); }); }); h.prepend(a); }); });",
+ },
+ {
+ tag: "script",
+ content:
"document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('[href=\"#_top\"] span').forEach(el => { if (el.textContent === 'トップへ戻る') el.textContent = ''; }); });",
},
],
components: {
PageTitle: "./src/components/starlight/PageTitle.astro",
SocialIcons: "./src/components/starlight/SocialIcons.astro",
+ Footer: "./src/components/starlight/Footer.astro",
},
}),
],