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
| async fetchSuggestions(tags: string[], currentArticleSlug: string) { | |
| const limit = 3; // limit of posts we want to fetch | |
| let entries = []; | |
| const initialOptions = { | |
| content_type: CONTENT_TYPE_BLOGPOST, | |
| limit, | |
| // find at least one matching tag, else undefined properties are not copied | |
| 'fields.tags.sys.id[in]': tags.length ? tags.join(',') : undefined, |
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 { createClient } from 'contentful'; | |
| import { BlogPost } from '../interfaces/post'; | |
| export const CONTENT_TYPE_BLOGPOST = 'blogPost'; | |
| export const CONTENT_TYPE_PERSON = 'author'; | |
| export const CONTENT_TYPE_TAGS = 'tag'; | |
| const Space = process.env.CONTENTFUL_SPACE; | |
| const Token = process.env.CONTENTFUL_TOKEN; |
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
| // Helper functions | |
| export const getNavigationLink = (slug) => `/post/${slug}`; | |
| export const getHref = (slug) => ({ | |
| pathname: '/post', | |
| query: {post: slug}, | |
| }); |
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
| .post-container { | |
| margin: 1rem auto 1rem 4rem; | |
| width: 65%; | |
| } | |
| .markdown p, | |
| .markdown ul, | |
| .markdown ol { | |
| margin-bottom: 1.5rem; |
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 { NextPage } from 'next'; | |
| import React from 'react'; | |
| import ReactMarkdown from 'react-markdown'; | |
| import './styles.css'; | |
| import { ContentfulService } from '../../core/contentful'; | |
| import Layout from '../../shared/components/layout/layout.component'; |
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>) | |
| }; |
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
| 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
| /* | |
| 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'); |
NewerOlder