Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on:
pull_request:
branches:
- main
paths:
- 'website/**'

jobs:
build:
if: github.head_ref == 'website'
runs-on: ubuntu-latest

steps:
Expand Down
6 changes: 4 additions & 2 deletions website/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {Metadata} from "next";
import {NextraSearchDialog} from "@/components/nextra-search-dialog";
import {getPagesFromPageMap} from "@/lib/getPagesFromPageMap";

import { prefix } from "@/prefix";

export const metadata: Metadata = {
// Define your metadata here
// For more information on metadata API, see: https://nextjs.org/docs/app/building-your-application/optimizing/metadata
Expand All @@ -17,14 +19,14 @@ const navbar = (
logo={
<div style={{ display: "flex", alignItems: "center", gap: "0.5rem" }}>
<img
src="/images/general/logo.svg"
src={`${prefix}/images/general/logo.svg`}
alt="Logo light"
width={20}
height={20}
className="block dark:hidden"
/>
<img
src="/images/general/logo_dark.svg"
src={`${prefix}/images/general/logo_dark.svg`}
alt="Logo dark"
width={20}
height={20}
Expand Down
6 changes: 4 additions & 2 deletions website/components/nextra-search-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {useRouter} from "next/navigation";
import {PageItem} from "@/lib/getPagesFromPageMap";
import {Kbd} from "@/components/ui/kbd";

import { prefix } from "@/prefix";

type Props = {
placeholder?: string;
pages?: PageItem[];
Expand Down Expand Up @@ -337,7 +339,7 @@ function highlightQuery(text: string, query: string) {
const parts = text.split(regex);

return parts.map((part, index) =>
regex.test(part) ? <mark key={index} className="bg-primary text-primary-foreground rounded-[3px] font-medium">{part}</mark> : part
regex.test(part) ? <mark key={index} className="bg-blue-500 dark:bg-blue-500 text-primary-foreground rounded-[3px] font-medium">{part}</mark> : part
);
}

Expand All @@ -358,7 +360,7 @@ declare global {
async function importPagefind() {
if (window.pagefind) return;
window.pagefind = await import(
/* webpackIgnore: true */ addBasePath('/_pagefind/pagefind.js')
/* webpackIgnore: true */ addBasePath(`${prefix}/_pagefind/pagefind.js` )
);
await window.pagefind.options({
baseUrl: '/'
Expand Down
8 changes: 4 additions & 4 deletions website/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import nextra from "nextra";

import { prefix } from "./prefix.ts";

const withNextra = nextra({
search: true,
defaultShowCopyCode: true,
});

const isProd = process.env.NODE_ENV === 'production'

/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
basePath: isProd ? '/c_traceback' : '',
assetPrefix: isProd ? '/c_traceback/' : '',
basePath: prefix,
assetPrefix: prefix,
images: { unoptimized: true }
}

Expand Down
11 changes: 6 additions & 5 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "nextra-docs-starter",
"version": "1.0.0",
"description": "Nextra docs starter with search included.",
"version": "0.0.1",
"description": "A colorful, lightweight error-propagation framework for C.",
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
Expand All @@ -10,14 +11,14 @@
},
"repository": {
"type": "module",
"url": "https://github.com/phucbm/nextra-docs-starter"
"url": "https://github.com/alvinng4/c_traceback"
},
"author": "PHUCBM",
"license": "MIT",
"bugs": {
"url": "https://github.com/phucbm/nextra-docs-starter/issues"
"url": "https://github.com/alvinng4/c_traceback/issues"
},
"homepage": "https://github.com/phucbm/nextra-docs-starter#readme",
"homepage": "https://github.com/alvinng4/c_traceback#readme",
"dependencies": {
"@radix-ui/react-dialog": "^1.1.15",
"@tailwindcss/postcss": "^4.1.18",
Expand Down
3 changes: 3 additions & 0 deletions website/prefix.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const isProd = process.env.NODE_ENV === 'production';
const prefix = isProd ? '/c_traceback' : '';
export { prefix };