Skip to content

Commit

Permalink
Merge branch 'feature/return-prefix' into 'main'
Browse files Browse the repository at this point in the history
return prefixes

See merge request whitebit_exchange/api-docs!162
  • Loading branch information
whitebit-robot committed Nov 16, 2023
2 parents 0ebe343 + 72a0a27 commit b8bb3e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
const isProduction = process.env.NODE_ENV === "production";
export const assetPrefix = isProduction ? "/api-docs" : "";
8 changes: 6 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ const withNextra = require("nextra")({
themeConfig: "./theme.config.tsx",
});

const isProduction = process.env.NODE_ENV === "production";

const assetPrefix = isProduction ? "/api-docs" : "";

module.exports = {
...withNextra(),
images: {
Expand All @@ -11,6 +15,6 @@ module.exports = {
reactStrictMode: true,
swcMinify: true,
trailingSlash: true,
// assetPrefix,
// basePath: assetPrefix,
assetPrefix,
basePath: assetPrefix,
};
11 changes: 6 additions & 5 deletions theme.config.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import { DocsThemeConfig } from "nextra-theme-docs";
import { assetPrefix } from "./constants";

const config: DocsThemeConfig = {
logo: (
<img
src={"/img/logo.svg"}
src={`${assetPrefix}/img/logo.svg`}
alt={"WhiteBIT logo"}
width={32}
height={32}
Expand All @@ -18,7 +19,7 @@ const config: DocsThemeConfig = {
return {
titleTemplate: "%s | WhiteBIT API Documentation",
openGraph: {
images: [{ url: "/img/og-image.png" }],
images: [{ url: `${assetPrefix}/img/og-image.png` }],
siteName: "WhiteBIT API Documentation",
},
};
Expand All @@ -34,19 +35,19 @@ const config: DocsThemeConfig = {
<link
rel="shortcut icon"
type="image/x-icon"
href={"/img/favicon.ico"}
href={`${assetPrefix}/img/favicon.ico`}
/>
<link
rel="icon"
type="image/x-icon"
sizes="16x16"
href={"/img/favicon-16x16.png"}
href={`${assetPrefix}/img/favicon-16x16.png`}
/>
<link
rel="icon"
type="image/x-icon"
sizes="32x32"
href={"/img/favicon-32x32.png"}
href={`${assetPrefix}/img/favicon-32x32.png`}
/>
</>
),
Expand Down

0 comments on commit b8bb3e4

Please sign in to comment.