Skip to content

Commit

Permalink
feat: Add Analytics and update X icon
Browse files Browse the repository at this point in the history
  • Loading branch information
WayneGoosen committed Apr 10, 2024
1 parent bcbcc6c commit 44db4a8
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 43 deletions.
63 changes: 33 additions & 30 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
import { defineConfig } from 'astro/config'
import mdx from '@astrojs/mdx'
import sitemap from '@astrojs/sitemap'
import tailwind from '@astrojs/tailwind'
import { remarkReadingTime } from './src/utils/readTime.ts'
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import tailwind from '@astrojs/tailwind';
import { remarkReadingTime } from './src/utils/readTime.ts';
import partytown from "@astrojs/partytown";

// https://astro.build/config
export default defineConfig({
site: 'https://waynegoosen.github.io/', // Write here your website url
markdown: {
remarkPlugins: [remarkReadingTime],
drafts: true,
shikiConfig: {
theme: 'material-theme-palenight',
wrap: true
}
},
integrations: [
mdx({
syntaxHighlight: 'shiki',
shikiConfig: {
experimentalThemes: {
light: 'vitesse-light',
dark: 'material-theme-palenight',
},
wrap: true
},
drafts: true
}),
sitemap(),
tailwind()
]
})
site: 'https://waynegoosen.github.io/',
// Write here your website url
markdown: {
remarkPlugins: [remarkReadingTime],
drafts: true,
shikiConfig: {
theme: 'material-theme-palenight',
wrap: true
}
},
integrations: [mdx({
syntaxHighlight: 'shiki',
shikiConfig: {
experimentalThemes: {
light: 'vitesse-light',
dark: 'material-theme-palenight'
},
wrap: true
},
drafts: true
}), sitemap(), tailwind(),
partytown({
config: {
forward: ['dataLayer.push']
}
})]
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"prepare": "husky install"
},
"dependencies": {
"@astrojs/partytown": "^2.0.4",
"@astrojs/rss": "4.0.1",
"astro": "4.0.8",
"astro-font": "^0.0.72"
Expand Down
37 changes: 29 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/components/GoogleAnalytics.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
type Props = { measurementId: string}
const props = Astro.props as Props
const measurementId = props.measurementId
---
<script
type='text/partytown'
src={`https://www.googletagmanager.com/gtag/js?id=${measurementId}`}></script>
<script type='text/partytown'>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', `${measurementId}`);
</script>
8 changes: 3 additions & 5 deletions src/components/icons/TwitterIcon.astro
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<svg
xmlns='http://www.w3.org/2000/svg'
class='w-8 md:w-6'
viewBox='0 0 24 24'
viewBox='0 0 252 252'
stroke-width='1.3'
stroke='currentColor'
fill='none'
stroke-linecap='round'
stroke-linejoin='round'
>
<path stroke='none' d='M0 0h24v24H0z' fill='none'></path>
<path
d='M22 4.01c-1 .49 -1.98 .689 -3 .99c-1.121 -1.265 -2.783 -1.335 -4.38 -.737s-2.643 2.06 -2.62 3.737v1c-3.245 .083 -6.135 -1.395 -8 -4c0 0 -4.182 7.433 4 11c-1.872 1.247 -3.739 2.088 -6 2c3.308 1.803 6.913 2.423 10.034 1.517c3.58 -1.04 6.522 -3.723 7.651 -7.742a13.84 13.84 0 0 0 .497 -3.753c0 -.249 1.51 -2.772 1.818 -4.013z'
></path>
<path d="M126 250.793C195.036 250.793 251 194.875 251 125.897C251 56.9181 195.036 1 126 1C56.9644 1 1 56.9181 1 125.897C1 194.875 56.9644 250.793 126 250.793Z" fill="grey" stroke="white" stroke-miterlimit="10"></path>
<path d="M48.9999 53.5352L108.748 133.357L48.6233 198.256H62.1561L114.797 141.435L157.327 198.256H203.377L140.265 113.945L196.23 53.5352H182.697L134.219 105.865L95.0494 53.5352H48.9999ZM68.9004 63.4941H90.0554L183.474 188.297H162.319L68.9004 63.4941Z" fill="white"></path>
</svg>
2 changes: 2 additions & 0 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import ProviderTheme from '@/components/ProviderTheme'
import ProviderAnimations from '@/components/ProviderAnimations'
import TwSizeIndicator from '@/components/TwSizeIndicator'
import EditBlog from '@/components/editBlog'
import GoogleAnalytics from '@/components/GoogleAnalytics'
const { title, description, image, articleDate } = Astro.props
---

<html lang='en' class='scroll-smooth'>
<head>
<BaseHead title={title} description={description} ogImage={image} articleDate={articleDate} />
<GoogleAnalytics measurementId='G-6SV71EBG61' />
<ProviderTheme />
<ProviderAnimations />
</head>
Expand Down

0 comments on commit 44db4a8

Please sign in to comment.