diff --git a/packages/astro-meta-tags/package.json b/packages/astro-meta-tags/package.json index 53e5357..cf12bad 100644 --- a/packages/astro-meta-tags/package.json +++ b/packages/astro-meta-tags/package.json @@ -1,6 +1,6 @@ { "name": "astro-meta-tags", - "version": "0.2.1", + "version": "0.2.2", "author": "Patrick Arminio", "repository": "github:patrick91/astro-meta-tags", "license": "MIT", diff --git a/packages/astro-meta-tags/src/toolbar.ts b/packages/astro-meta-tags/src/toolbar.ts index 40f447c..9ddfa0f 100644 --- a/packages/astro-meta-tags/src/toolbar.ts +++ b/packages/astro-meta-tags/src/toolbar.ts @@ -10,19 +10,19 @@ const getWindowContent = () => { .querySelector("meta[name='description']") ?.getAttribute("content"); - const getTagTuple = (tag: Element) => - [tag.getAttribute("property"), tag.getAttribute("content")] as [ + const getTagTuple = (tag: Element, attributeName: string = "property") => + [tag.getAttribute(attributeName), tag.getAttribute("content")] as [ string, string ]; const ogMetaTags = Array.from( document.querySelectorAll("meta[property^='og:']") - ).map(getTagTuple); + ).map((tag) => getTagTuple(tag, "property")); const twitterMetaTags = Array.from( - document.querySelectorAll("meta[property^='twitter:']") - ).map(getTagTuple); + document.querySelectorAll("meta[name^='twitter:']") + ).map((tag) => getTagTuple(tag, "name")); const getSingleTagHtml = ([property, content]: [string, string]) => { let contentTag: HTMLElement | Text; @@ -43,7 +43,7 @@ const getWindowContent = () => { tagHtml.append(propertyName, propertyValue); - return tagHtml + return tagHtml; }; const getTagsHtml = ( @@ -62,7 +62,7 @@ const getWindowContent = () => { } const details = document.createElement("details"); - + const summary = document.createElement("summary"); summary.textContent = title; diff --git a/packages/demo/src/components/BaseHead.astro b/packages/demo/src/components/BaseHead.astro index 3441240..0f04721 100644 --- a/packages/demo/src/components/BaseHead.astro +++ b/packages/demo/src/components/BaseHead.astro @@ -40,8 +40,8 @@ const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props; - - - - - + + + + +