1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 22:08:02 +00:00

use NEXT_PUBLIC_

This commit is contained in:
Nebel 2020-06-11 22:10:26 +09:00
parent 5de84b485f
commit bcc84f1bc9
4 changed files with 12 additions and 12 deletions

View file

@ -17,7 +17,7 @@ jobs:
restore-keys: yarn-
- run: yarn
- run: git -c user.name="$(whoami)" subtree add --prefix docs origin gh-pages
- run: NEXT_ASSET_PREFIX=/${GITHUB_REPOSITORY#*/} yarn doc
- run: NEXT_PUBLIC_BASE_PATH=/${GITHUB_REPOSITORY#*/} yarn doc
- run: git add -f docs
- run: git -c user.name="$(whoami)" commit -m github-pages
- run: git remote add github "https://github:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"

View file

@ -1,9 +1,8 @@
const NEXT_BASE_PATH = process.env.NEXT_ASSET_PREFIX || "";
module.exports = require("@next/mdx")({
extension: /\.mdx?$/,
})({
pageExtensions: ["ts", "tsx", "md", "mdx"],
assetPrefix: NEXT_BASE_PATH,
env: { NEXT_BASE_PATH },
experimental: {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "",
},
});

View file

@ -51,11 +51,11 @@ export const components: {
h5: (props) => <Typography component="h5" variant="h6" {...props} />,
h6: (props) => <Typography variant="h6" {...props} />,
a: ({ href, ...props }: { href: string }) => {
const url = `${process.env.NEXT_BASE_PATH}${href}`;
const url = [process.env.NEXT_PUBLIC_BASE_PATH, href].join("");
return isValidURL(href) ? (
<MuiLink variant="body1" color="secondary" href={href} {...props} />
) : (
<Link href={href} as={url}>
<Link href={href}>
<MuiLink variant="body1" color="secondary" href={url} {...props} />
</Link>
);

View file

@ -27,11 +27,12 @@ const TopAppBar = () => {
value={pathname}
icon={icon}
component={React.forwardRef<HTMLAnchorElement, {}>((props, ref) => (
<Link
href={pathname}
as={`${process.env.NEXT_BASE_PATH}${pathname}`}
>
<a ref={ref} {...props} />
<Link href={pathname}>
<a
ref={ref}
href={[process.env.NEXT_PUBLIC_BASE_PATH, pathname].join("")}
{...props}
/>
</Link>
))}
/>