1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 09:13:35 +01:00

move typekit id to env var

This commit is contained in:
Matthias Kretschmann 2021-09-12 23:21:47 +02:00
parent 5776238b6a
commit 7b6c9dddb8
Signed by: m
GPG Key ID: 606EEEF3C479A91F
7 changed files with 11 additions and 18 deletions

View File

@ -1,2 +1,3 @@
GATSBY_GITHUB_TOKEN=your_token GATSBY_GITHUB_TOKEN=your_token
GATSBY_MAPBOX_ACCESS_TOKEN= GATSBY_MAPBOX_ACCESS_TOKEN=
GATSBY_TYPEKIT_ID=xxx

View File

@ -77,6 +77,7 @@ jobs:
- run: npm run build - run: npm run build
env: env:
GATSBY_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GATSBY_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GATSBY_TYPEKIT_ID: ${{ secrets.GATSBY_TYPEKIT_ID }}
GATSBY_MAPBOX_ACCESS_TOKEN: ${{ secrets.GATSBY_MAPBOX_ACCESS_TOKEN }} GATSBY_MAPBOX_ACCESS_TOKEN: ${{ secrets.GATSBY_MAPBOX_ACCESS_TOKEN }}
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1

View File

@ -18,7 +18,6 @@ module.exports = {
}, },
rss: '/feed.xml', rss: '/feed.xml',
jsonfeed: '/feed.json', jsonfeed: '/feed.json',
typekitID: 'msu4qap',
itemsPerPage: 24, itemsPerPage: 24,
repoContentPath: 'https://github.com/kremalicious/blog/tree/main/content', repoContentPath: 'https://github.com/kremalicious/blog/tree/main/content',
menu: [ menu: [

View File

@ -15,7 +15,6 @@
"bitcoin": "171qDmKEXm9YBgBLXyGjjPvopP5o9htQ1V", "bitcoin": "171qDmKEXm9YBgBLXyGjjPvopP5o9htQ1V",
"ether": "0x339dbC44d39bf1961E385ed0Ae88FC6069b87Ea1" "ether": "0x339dbC44d39bf1961E385ed0Ae88FC6069b87Ea1"
}, },
"typekitID": "msu4qap",
"menu": [ "menu": [
{ {
"title": "Photos", "title": "Photos",

View File

@ -20,7 +20,6 @@ export interface Site {
siteDescription: string siteDescription: string
siteUrl: string siteUrl: string
author: Author author: Author
typekitID: string
menu: MenuItem[] menu: MenuItem[]
rss: string rss: string
jsonfeed: string jsonfeed: string

View File

@ -1,13 +1,12 @@
import React, { ReactElement } from 'react' import React from 'react'
import { Helmet } from 'react-helmet' import { Helmet } from 'react-helmet'
import { useSiteMetadata } from '../../hooks/use-site-metadata'
const TypekitScript = (typekitID: string) => ( const TypekitScript = () => (
<script> <script>
{` {`
(function(d) { (function(d) {
var config = { var config = {
kitId: '${typekitID}', kitId: '${process.env.GATSBY_TYPEKIT_ID}',
scriptTimeout: 3000, scriptTimeout: 3000,
async: true async: true
}, },
@ -17,15 +16,11 @@ const TypekitScript = (typekitID: string) => (
</script> </script>
) )
export default function Typekit(): ReactElement { export default function Typekit(): JSX.Element {
const { typekitID } = useSiteMetadata() return (
return typekitID ? (
<Helmet> <Helmet>
<link rel="dns-prefetch" href="https://use.typekit.net/" /> <link rel="preconnect" href="https://use.typekit.net" />
<link rel="dns-prefetch" href="https://p.typekit.net/" /> <TypekitScript />
{TypekitScript(typekitID)}
</Helmet> </Helmet>
) : null )
} }

View File

@ -19,7 +19,6 @@ const query = graphql`
bitcoin bitcoin
ether ether
} }
typekitID
menu { menu {
title title
link link