Skip to content

Commit 525ecf8

Browse files
authored
serve previews from /docs and fix broken asset paths (#185)
1 parent 11b1c9e commit 525ecf8

File tree

8 files changed

+35
-19
lines changed

8 files changed

+35
-19
lines changed

.github/workflows/preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
env:
3737
CONTEXT: deploy-preview
3838
NETLIFY: true
39-
run: yarn build
39+
run: yarn build --out-dir build/docs
4040

4141
- name: Deploy to Netlify
4242
id: netlify
@@ -61,7 +61,7 @@ jobs:
6161
message: |
6262
:rocket: **Build success!**
6363
64-
Latest successful preview: ${{ env.NETLIFY_PREVIEW_URL }}
64+
Latest successful preview: ${{ env.NETLIFY_PREVIEW_URL }}/docs/
6565
6666
Commit SHA: ${{ github.event.pull_request.head.sha }}
6767

docusaurus.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import dotenv from "dotenv"
55
const ssrTemplate = require("./src/internals/ssr.template")
66
const customFields = require("./src/config/customFields")
77
const path = require("path")
8-
const isPreviews = process.env.NETLIFY && process.env.CONTEXT === 'deploy-preview'
98

109
dotenv.config()
1110

11+
const isPreviews = process.env.NETLIFY && process.env.CONTEXT === 'deploy-preview'
12+
1213
const config = {
1314
title: "QuestDB",
1415
tagline: "QuestDB is the fastest open source time series database",
1516
url: `https://${customFields.domain}`,
16-
baseUrl: isPreviews ? '/' : '/docs/',
17+
baseUrl: '/docs/',
1718
baseUrlIssueBanner: false,
1819
favicon: "/images/favicon.webp",
1920
organizationName: "QuestDB",

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
from = "/docs/troubleshooting/log/"
33
to = "/docs/operations/logging-metrics/"
44
status = 301
5-
force = true
5+
force = true

src/components/Clients/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DocButton } from '../DocButton'; // Assuming DocButton is in the parent directory
2+
import useBaseUrl from '@docusaurus/useBaseUrl';
23

34
interface Client {
45
href: string;
@@ -171,7 +172,7 @@ export function Clients({ showProtocol }: ClientDisplayProps) {
171172
</p>
172173
</div>
173174
<img
174-
src={client.logo}
175+
src={useBaseUrl(client.logo)}
175176
alt={`${client.name} logo`}
176177
className={`h-12 w-12 ${client.name === 'Rust' ? 'dark:invert' : ''}`}
177178
/>

src/components/MainCTA/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const useButtonProps = () => {
1212
const { pathname } = useLocation()
1313
const origin = pathname.split("/")[1]
1414
const source = origin === "" ? "Main" : hyphenToPascalCase(origin)
15-
const url = "/download/"
16-
const destination = "Download"
17-
const ctaLabel = "Download"
15+
const url = "/enterprise/contact/"
16+
const destination = "CONTACT"
17+
const ctaLabel = "CONTACT"
1818

1919
return { ctaLabel, source, destination, url }
2020
}

src/components/Tailwind/WideNav/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {
77
Transition,
88
} from "@headlessui/react"
99
import {
10-
EnvelopeIcon,
1110
Bars3Icon,
1211
PlayCircleIcon,
1312
RocketLaunchIcon,
1413
PresentationChartLineIcon,
14+
ArrowDownTrayIcon,
1515
} from "@heroicons/react/24/outline"
1616
import { ChevronDownIcon } from "@heroicons/react/20/solid"
1717
import SearchBar from "@theme/SearchBar"
@@ -83,9 +83,9 @@ const callsToAction = [
8383
icon: PlayCircleIcon,
8484
},
8585
{
86-
name: "Contact for pricing",
87-
href: "/enterprise/contact/",
88-
icon: EnvelopeIcon,
86+
name: "Download QuestDB",
87+
href: "/download/",
88+
icon: ArrowDownTrayIcon,
8989
},
9090
{
9191
name: "View real-time crypto dashboards",

src/theme/ILPClientsTable/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import useBaseUrl from '@docusaurus/useBaseUrl'
12
import style from "./style.module.css"
23

34
type Client = {
@@ -82,8 +83,8 @@ export const ILPClientsTable = ({ language }: ILPClientsTableProps) => {
8283
)
8384
.map(({ label, logoSrc, lightThemeLogoSrc, docsUrl, sourceUrl }) => (
8485
<div className={style.client} key={label}>
85-
<div className={style.logo}>
86-
<img src={lightThemeLogoSrc ?? logoSrc} alt={label} />
86+
<div className={style.logo} data-language={label}>
87+
<img src={useBaseUrl(lightThemeLogoSrc ?? logoSrc)} alt={label} />
8788
</div>
8889

8990
<div className={style.buttons}>
@@ -96,8 +97,8 @@ export const ILPClientsTable = ({ language }: ILPClientsTableProps) => {
9697
<img
9798
alt="Documentation icon"
9899
height={22}
99-
src="/images/icons/open-book.svg"
100-
style={{ filter: "invert(1)" }}
100+
src={useBaseUrl("/images/icons/open-book.svg")}
101+
className={style.docsIcon}
101102
title="Documentation"
102103
width={22}
103104
/>
@@ -113,7 +114,8 @@ export const ILPClientsTable = ({ language }: ILPClientsTableProps) => {
113114
<img
114115
alt="Github icon"
115116
height={22}
116-
src="/images/github.svg"
117+
src={useBaseUrl("/images/github.svg")}
118+
className={style.ghIcon}
117119
title="Source"
118120
width={22}
119121
/>

src/theme/ILPClientsTable/style.module.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
object-fit: cover;
3838
}
3939

40+
.logo[data-language="Rust"] img {
41+
filter: invert(1);
42+
}
43+
4044
.buttons {
4145
display: flex;
4246
flex-direction: column;
@@ -46,7 +50,7 @@
4650

4751
.button {
4852
display: flex;
49-
justify-content: center;
53+
justify-content: flex-start;
5054
align-items: center;
5155
gap: 1rem;
5256
background-color: var(--palette-white-20);
@@ -62,6 +66,14 @@
6266
color: var(--theme-button-secondary-text-color);
6367
}
6468

69+
.button:hover .docsIcon {
70+
filter: invert(1);
71+
}
72+
73+
.button:not(:hover) .ghIcon {
74+
filter: invert(1);
75+
}
76+
6577
:global(html[data-theme="light"]) .button {
6678
background-color: var(--palette-dark-10);
6779
color: var(--theme-button-secondary-text-color);

0 commit comments

Comments
 (0)