This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Add your GA tracking id here | |
| export const GA_TRACKING_ID = ''; | |
| const isProduction = process.env.NODE_ENV.toLowerCase() === 'production'; | |
| // https://developers.google.com/analytics/devguides/collection/gtagjs/pages | |
| export const trackPageView = url => { | |
| if (isProduction) { | |
| // @ts-ignore | |
| window.gtag('config', GA_TRACKING_ID, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Fragment } from 'react'; | |
| import Document, { Head, Main, NextScript } from 'next/document'; | |
| import { GA_TRACKING_ID } from '../core/gtag'; | |
| type Props = { | |
| isProduction: boolean, | |
| } | |
| export default class extends Document<Props> { | |
| static async getInitialProps(ctx) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import App from 'next/app'; | |
| import React from 'react'; | |
| import Router from 'next/router'; | |
| import {trackPageView} from '../core/gtag'; | |
| Router.events.on('routeChangeComplete', url => trackPageView(url)); | |
| class MyApp extends App { | |
| render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path'); | |
| const Dotenv = require('dotenv-webpack'); | |
| const next_config = { | |
| webpack: config => { | |
| config.plugins = config.plugins || []; | |
| config.plugins = [ | |
| ...config.plugins, | |
| // Read the .env file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // next.config.js | |
| const withCSS = require('@zeit/next-css'); | |
| module.exports = withCSS({}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, {useEffect, useState} from 'react'; | |
| import {NextPage} from 'next'; | |
| import {useRouter} from 'next/router' | |
| import {ContentfulService} from '../core/contentful'; | |
| import {BlogPost} from '../interfaces/post'; | |
| import Layout from '../shared/components/layout'; | |
| import Card from '../shared/components/card'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Generates a sitemap based on the entries in exportPathMap in next.config.js file | |
| Don't forget to add the domain name as process variable PUBLIC_DOMAIN! | |
| */ | |
| const fs = require('fs'); | |
| // Read from the static map that's provided by next | |
| const { exportPathMap } = require('../next.config'); | |
| const { generateAllArticles } = require('./helpers'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('dotenv').config(); | |
| const { generateSitemap } = require('./sitemap'); | |
| generateSitemap(process.env.PUBLIC_DOMAIN, './out/'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { PageType, RobotsContent, Tag } from '../interfaces/tag'; | |
| import { concatenateStrings } from '../shared/helpers/helper'; | |
| export const defaultMetaTags: Tag = { | |
| canonical: 'https://www.techhive.io', | |
| description: 'Pushing you to the edge of technological innovation', | |
| image: 'https://www.techhive.io/image.png', | |
| robots: concatenateStrings(RobotsContent.index, RobotsContent.follow), | |
| title: 'Techhive.IO', | |
| type: PageType.website |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { NextPage } from 'next'; | |
| type Props = {} | |
| const IndexPage: NextPage = (props: Props) => { | |
| return (<div>Hello World!</div>) | |
| }; |