From 0fab3f94bb8c981a92e772f30b2a43a3a68bfec9 Mon Sep 17 00:00:00 2001 From: Saiya Date: Sat, 17 Aug 2024 18:07:10 +0800 Subject: [PATCH] feat: update for seo --- astro.config.ts | 1 + public/post-a11y.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/astro.config.ts b/astro.config.ts index f21d0d8..61079d4 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -7,6 +7,7 @@ import rehypeExternalLinks from 'rehype-external-links'; // https://astro.build/config export default defineConfig({ + site: 'https://app.evecalm.com', base: '/frontend-guideline/', markdown: { rehypePlugins: [ diff --git a/public/post-a11y.js b/public/post-a11y.js index eb72d75..d6e5ac5 100644 --- a/public/post-a11y.js +++ b/public/post-a11y.js @@ -1,6 +1,8 @@ document.body.querySelectorAll('.sl-container img').forEach((img) => { - const title = img.getAttribute('title') || img.getAttribute('alt'); + const title = img.getAttribute('alt'); if (!title) return; + // remove for seo, as it's already in the figcaption + img.removeAttribute('alt'); const figure = document.createElement('figure'); img.parentNode.replaceChild(figure, img); figure.appendChild(img);