diff --git a/next.config.js b/next.config.js
index 395e065..4b0478c 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,6 +1,9 @@
+const NEXT_BASE_PATH = process.env.NEXT_ASSET_PREFIX || "";
+
module.exports = require("@next/mdx")({
extension: /\.mdx?$/
})({
pageExtensions: ["ts", "tsx", "md", "mdx"],
- assetPrefix: process.env.NEXT_ASSET_PREFIX || ""
+ assetPrefix: NEXT_BASE_PATH,
+ env: { NEXT_BASE_PATH }
});
diff --git a/styles/MainTheme.tsx b/styles/MainTheme.tsx
index 04e50d9..3377754 100644
--- a/styles/MainTheme.tsx
+++ b/styles/MainTheme.tsx
@@ -11,6 +11,15 @@ import Head from "next/head";
import Link from "next/link";
import TopAppBar from "./TopAppBar";
+const isValidURL = (url: string) => {
+ try {
+ new URL(url);
+ } catch {
+ return false;
+ }
+ return true;
+};
+
export const theme = createMuiTheme({
palette: {
primary: {
@@ -39,11 +48,17 @@ export const components = {
h4: (props: {}) => ,
h5: (props: {}) => ,
h6: (props: {}) => ,
- a: ({ href, ...props }: { href: string }) => (
-
-
-
- )
+ a: ({ href, ...props }: { href: string }) => {
+ const url = isValidURL(href)
+ ? href
+ : `${process.env.NEXT_BASE_PATH}${href}`;
+
+ return (
+
+
+
+ );
+ }
};
const MainTheme: React.FC = ({ children }) => (
diff --git a/styles/TopAppBar.tsx b/styles/TopAppBar.tsx
index 1763ac9..6a43d71 100644
--- a/styles/TopAppBar.tsx
+++ b/styles/TopAppBar.tsx
@@ -1,5 +1,6 @@
import React from "react";
import { useRouter } from "next/router";
+import Link from "next/link";
import AppBar from "@material-ui/core/AppBar";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";
@@ -24,7 +25,19 @@ const TopAppBar = () => {
textColor="primary"
>
{routes.map(({ pathname, icon }) => (
-
+ (
+
+
+
+ )}
+ />
))}