commit 0f6323189ae8eac2c2336b823e97193040772d1b
parent 53af9134c9d23ddd2656cb78e9cf33115865f050
Author: Agastya Chandrakant <me@hanabi.in>
Date: Wed, 11 Mar 2020 20:44:06 +0530
Change links to make it work with gh pages
Diffstat:
11 files changed, 53 insertions(+), 23 deletions(-)
diff --git a/gatsby-config.js b/gatsby-config.js
@@ -1,5 +1,4 @@
const path = require('path');
-
module.exports = {
siteMetadata: {
author: 'Agastya Chandrakant',
@@ -7,8 +6,9 @@ module.exports = {
email: 'acagastya@outlook.com',
github: 'acagastya',
instagram: 'acagastya',
+ repo: 'quotes',
siteName: 'Quotes',
- siteUrl: 'https://acagastya.github.io/quotes',
+ siteUrl: 'https://acagastya.github.io/quotes/',
title: 'Quotes',
twitter: '@acagastya',
username: 'acagastya',
diff --git a/package.json b/package.json
@@ -37,7 +37,7 @@
"private": true,
"repository": {
"type": "git",
- "url": "https://github.com/acagastya/quotes"
+ "url": "https://github.com/acagastya/quotes/"
},
"scripts": {
"build": "gatsby clean && gatsby build",
diff --git a/src/components/header.js b/src/components/header.js
@@ -3,7 +3,9 @@
import { Link } from 'gatsby';
import PropTypes from 'prop-types';
import React from 'react';
+import { siteMetadata } from '../../gatsby-config';
+const { repo } = siteMetadata;
function Header({ description, link = '/', showHeader, siteTitle, slug }) {
return (
<header id="header" className="header-container">
@@ -18,21 +20,21 @@ function Header({ description, link = '/', showHeader, siteTitle, slug }) {
{slug == 'quote' ? (
<BoldEntry text="Quotes" />
) : (
- <Link to="/quote">Quotes</Link>
+ <Link to={`/${repo}/quote`}>Quotes</Link>
)}
</li>
<li>
{slug == 'about' ? (
<BoldEntry text="About" />
) : (
- <Link to="/about">About</Link>
+ <Link to={`/${repo}/about`}>About</Link>
)}
</li>
<li>
{slug == 'random' ? (
- <BoldLinkEntry text="Random" path="/random" />
+ <BoldLinkEntry text="Random" path={`/${repo}/random/`} />
) : (
- <Link to="/random">Random</Link>
+ <Link to={`/${repo}/random`}>Random</Link>
)}
</li>
</ul>
@@ -41,7 +43,7 @@ function Header({ description, link = '/', showHeader, siteTitle, slug }) {
{showHeader && (
<div className="header-info">
<p className="site-title title">
- <Link to={link}>{siteTitle}</Link>
+ <Link to={`/${repo}/${link}/`}>{siteTitle}</Link>
</p>
{siteTitle == 'Quotes' && (
<p className="site-description subtitle">{description}</p>
@@ -65,7 +67,7 @@ function BoldEntry({ text = '' }) {
return <span style={{ fontWeight: 700, cursor: 'default' }}>{text}</span>;
}
-function BoldLinkEntry({ text = '', path = '/' }) {
+function BoldLinkEntry({ text = '', path = `/${repo}` }) {
return (
<span style={{ fontWeight: 700, cursor: 'default' }}>
<Link to={path}>{text}</Link>
diff --git a/src/pages/index.js b/src/pages/index.js
@@ -2,6 +2,9 @@ import React from 'react';
import { Link, graphql } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
+import { siteMetadata } from '../../gatsby-config';
+
+const { repo } = siteMetadata;
function IndexPage({ data }) {
const { edges } = data.allMarkdownRemark;
@@ -32,7 +35,9 @@ function IndexPage({ data }) {
<span>
<span className="screen-reader">Quote by </span>
<span>
- <Link to={`/authors/${author}`}>{author}</Link>
+ <Link to={`${repo}/authors/${author}`}>
+ {author}
+ </Link>
{attributed ? (
<span>
<sup>
@@ -59,7 +64,7 @@ function IndexPage({ data }) {
</div>
<header className="list-item-header">
<h3 className="list-item-title">
- <Link to={`/quote/${path}`}>{title}</Link>
+ <Link to={`${repo}/quote/${path}`}>{title}</Link>
</h3>
</header>
</article>
diff --git a/src/pages/quote.js b/src/pages/quote.js
@@ -2,6 +2,9 @@ import React from 'react';
import { Link, graphql } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
+import { siteMetadata } from '../../gatsby-config';
+
+const { repo } = siteMetadata;
function Blog({ data }) {
const { edges } = data.allMarkdownRemark;
@@ -28,7 +31,9 @@ function Blog({ data }) {
<div className="meta">
<span>
<span className="screen-reader">Quote by </span>
- <Link to={`/authors/${author}`}>{author}</Link>
+ <Link to={`${repo}/authors/${author}`}>
+ {author}
+ </Link>
{attributed ? (
<span>
<sup>
@@ -54,7 +59,7 @@ function Blog({ data }) {
</div>
<header className="list-item-header">
<h3 className="list-item-title">
- <Link to={`/quote/${path}`}>{title}</Link>
+ <Link to={`${repo}/quote/${path}`}>{title}</Link>
</h3>
</header>
</article>
diff --git a/src/pages/random.js b/src/pages/random.js
@@ -2,6 +2,9 @@ import React from 'react';
import { Link, graphql } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
+import { siteMetadata } from '../../gatsby-config';
+
+const { repo } = siteMetadata;
function RandomQuotePage({ data }) {
const { edges } = data.allMarkdownRemark;
@@ -28,7 +31,7 @@ function RandomQuotePage({ data }) {
<header className="list-item-header">
<h3 className="list-item-title">
<em>
- <Link to={`/quote/${path}`}>{title}</Link>
+ <Link to={`${repo}/quote/${path}`}>{title}</Link>
</em>
</h3>
<div className="meta">
@@ -37,7 +40,7 @@ function RandomQuotePage({ data }) {
<span className="author-container">
<Link
className="author-container-link"
- to={`/authors/${author}`}
+ to={`${repo}/authors/${author}`}
>
{author}
</Link>
diff --git a/src/templates/allAuthorsTemplate.js b/src/templates/allAuthorsTemplate.js
@@ -2,6 +2,9 @@ import React from 'react';
import { Link } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
+import { siteMetadata } from '../../gatsby-config';
+
+const { repo } = siteMetadata;
function AllAuthorsTemplate({ pageContext }) {
const { authors, postsByAuthor } = pageContext;
@@ -23,7 +26,7 @@ function AllAuthorsTemplate({ pageContext }) {
return (
<li key={author}>
<Link
- to={`/authors/${author}`}
+ to={`/${repo}/authors/${author}`}
style={{ fontSize: `${1 + num}em`, fontWeight: `${weight}` }}
>
{author}
diff --git a/src/templates/allTagsTemplate.js b/src/templates/allTagsTemplate.js
@@ -2,6 +2,9 @@ import React from 'react';
import { Link } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
+import { siteMetadata } from '../../gatsby-config';
+
+const { repo } = siteMetadata;
function AllTagsTemplate({ pageContext }) {
const { postsByTag, tags } = pageContext;
@@ -23,7 +26,7 @@ function AllTagsTemplate({ pageContext }) {
return (
<li key={tag}>
<Link
- to={`/tags/${tag}`}
+ to={`/${repo}/tags/${tag}`}
style={{ fontSize: `${1 + num}em`, fontWeight: `${weight}` }}
>
{tag}
diff --git a/src/templates/blogPost.js b/src/templates/blogPost.js
@@ -3,6 +3,9 @@ import { graphql, Link } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
import { CategorySVG, TagSVG } from '../components/partials/SVGIcon';
+import { siteMetadata } from '../../gatsby-config';
+
+const { repo } = siteMetadata;
function Template({ data }) {
const { markdownRemark } = data;
@@ -87,7 +90,7 @@ function Footer({ attributed, author, misattributed, tags, unverified }) {
<CategorySVG />
</span>
<span className="screen-reader">Author: </span>
- <Link className="author" to={`/authors/${author}`}>
+ <Link className="author" to={`/${repo}/authors/${author}`}>
{author}
</Link>
{attributed ? (
@@ -121,7 +124,7 @@ function Footer({ attributed, author, misattributed, tags, unverified }) {
{tags.map((tag, index) => {
return (
<React.Fragment key={tag}>
- <Link className="tag" to={`/tags/${tag}`}>
+ <Link className="tag" to={`/${repo}/tags/${tag}`}>
{tag}
</Link>
{index < tags.length - 1 ? ', ' : ' '}
diff --git a/src/templates/singleAuthorTemplate.js b/src/templates/singleAuthorTemplate.js
@@ -2,6 +2,9 @@ import React from 'react';
import { Link } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
+import { siteMetadata } from '../../gatsby-config';
+
+const { repo } = siteMetadata;
function SingleAuthorTemplate({ pageContext }) {
const { author, posts } = pageContext;
@@ -30,7 +33,7 @@ function SingleAuthorTemplate({ pageContext }) {
<span>
<span className="screen-reader">Quote by </span>
<span>
- <Link to={`/authors/${author}`}>{author}</Link>
+ <Link to={`/${repo}/authors/${author}`}>{author}</Link>
{attributed ? (
<span>
<sup>
@@ -57,7 +60,7 @@ function SingleAuthorTemplate({ pageContext }) {
</div>
<header className="list-item-header">
<h3 className="list-item-title">
- <Link to={`/quote/${path}`}>{title}</Link>
+ <Link to={`/${repo}/quote/${path}`}>{title}</Link>
</h3>
</header>
</article>
diff --git a/src/templates/singleTagTemplate.js b/src/templates/singleTagTemplate.js
@@ -2,6 +2,9 @@ import React from 'react';
import { Link } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
+import { siteMetadata } from '../../gatsby-config';
+
+const { repo } = siteMetadata;
function SingleTagTemplate({ pageContext }) {
const { posts, tag } = pageContext;
@@ -26,7 +29,7 @@ function SingleTagTemplate({ pageContext }) {
<span>
<span className="screen-reader">Quote by </span>
<span>
- <Link to={`/authors/${author}`}>{author}</Link>
+ <Link to={`/${repo}/authors/${author}`}>{author}</Link>
{attributed ? (
<span>
<sup>
@@ -53,7 +56,7 @@ function SingleTagTemplate({ pageContext }) {
</div>
<header className="list-item-header">
<h3 className="list-item-title">
- <Link to={`/quote/${path}`}>{title}</Link>
+ <Link to={`/${repo}/quote/${path}`}>{title}</Link>
</h3>
</header>
</article>