Skip to content

Commit

Permalink
fix: use gatsby Script API
Browse files Browse the repository at this point in the history
  • Loading branch information
yathomasi committed May 17, 2024
1 parent dfbf989 commit ef97e3f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
18 changes: 0 additions & 18 deletions packages/gatsby-theme-iterative/gatsby-ssr.js

This file was deleted.

29 changes: 19 additions & 10 deletions packages/gatsby-theme-iterative/src/components/SEO/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IGatsbyImageData } from 'gatsby-plugin-image'

import getSiteMeta from '../../queries/siteMeta'
import { buildMetadata, MetaProps, LinkProps } from './helper'
import { Script } from 'gatsby'

export interface IPaginatorPageInfo {
currentPage: number
Expand Down Expand Up @@ -113,16 +114,24 @@ const SEO: React.FC<ISEOProps> = ({
...link
]}
>
{siteMeta.plausibleSrc ? (
<script
defer
data-domain={
siteMeta.plausibleDomain || new URL(siteMeta.siteUrl).hostname
}
data-api={siteMeta.plausibleAPI || undefined}
src={siteMeta.plausibleSrc}
/>
) : null}
{siteMeta.plausibleSrc && (
<>
<Script
data-domain={
siteMeta.plausibleDomain || new URL(siteMeta.siteUrl).hostname
}
data-api={siteMeta.plausibleAPI || undefined}
src={siteMeta.plausibleSrc}
/>
<Script
id="plausible-custom-events"
dangerouslySetInnerHTML={{
__html:
'window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }'
}}
/>
</>
)}
{children}
</Helmet>
)
Expand Down

0 comments on commit ef97e3f

Please sign in to comment.