Skip to content

Commit

Permalink
Merge pull request #1424 from qdraw/feature/202403-gtag-consent-mode
Browse files Browse the repository at this point in the history
Feature/202403 gtag consent mode
  • Loading branch information
qdraw authored Mar 2, 2024
2 parents a83efac + afd245e commit cb5e866
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 177 deletions.
222 changes: 110 additions & 112 deletions documentation/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import type * as Preset from "@docusaurus/preset-classic";
import type { Config } from "@docusaurus/types";
import { themes as prismThemes } from "prism-react-renderer";

let url = "http://localhost:3003";
if (process.env.DOCS_URL && process.env.DOCS_URL.startsWith("https://")) {
url = process.env.DOCS_URL;
url = process.env.DOCS_URL;
}

let baseUrl = "/";
if (process.env.DOCS_BASE_URL && process.env.DOCS_BASE_URL.startsWith("/")) {
baseUrl = process.env.DOCS_BASE_URL;
baseUrl = process.env.DOCS_BASE_URL;
}

console.log(`url ${url}`);
console.log(`baseUrl ${baseUrl}`);

const gtag = {} as any;
const scripts = {} as any;
if (process.env.GTAG) {
console.log("gtag enabled");
gtag.gtag = {
trackingID: process.env.GTAG ? process.env.GTAG : "G-999X9XX9XX",
anonymizeIP: true,
};
console.log("gtag enabled");
scripts.scripts = [
`https://www.googletagmanager.com/gtag/js?id=${process.env.GTAG}`,
"/analytics.js",
];
}


const config: Config = {
title: 'Starsky',
tagline: 'Photo-management done right',
favicon: 'img/favicon.ico',
title: "Starsky",
tagline: "Photo-management done right",
favicon: "img/favicon.ico",

// Set the production url of your site here
url,
Expand All @@ -38,150 +37,149 @@ const config: Config = {

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'qdraw', // Usually your GitHub org/user name.
projectName: 'starsky', // Usually your repo name.
organizationName: "qdraw", // Usually your GitHub org/user name.
projectName: "starsky", // Usually your repo name.

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
defaultLocale: "en",
locales: ["en"],
},

presets: [
[
'classic',
"classic",
{
docs: {
sidebarPath: './sidebars.ts',
sidebarPath: "./sidebars.ts",
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
// editUrl:
// 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
// editUrl:
// 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
},
blog: {
showReadingTime: true,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
// editUrl:
// 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
// editUrl:
// 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
},
theme: {
customCss: './src/css/custom.css',
customCss: "./src/css/custom.css",
},
...gtag,
} satisfies Preset.Options,
],
],

...scripts,
plugins: [
[
require.resolve("@cmfcmf/docusaurus-search-local"),
{
indexDocs: true,
indexDocSidebarParentCategories: 3,
indexPages: true,
indexBlog: true,
maxSearchResults: 8,
},
require.resolve("@cmfcmf/docusaurus-search-local"),
{
indexDocs: true,
indexDocSidebarParentCategories: 3,
indexPages: true,
indexBlog: true,
maxSearchResults: 8,
},
],
],

themeConfig: {
navbar: {
title: "Starsky",
logo: {
alt: "Starsky Logo",
src: "img/detective.png",
title: "Starsky",
logo: {
alt: "Starsky Logo",
src: "img/detective.png",
},
items: [
{
type: "doc",
docId: "getting-started/readme",
position: "left",
label: "Getting started",
},
items: [
{
type: "doc",
docId: "getting-started/readme",
position: "left",
label: "Getting started",
},
{
type: "doc",
docId: "features/readme",
position: "left",
label: "Features",
},
{
type: "doc",
docId: "advanced-options/readme",
position: "left",
label: "Advanced options",
},
{
type: "doc",
docId: "features/readme",
position: "left",
label: "Features",
},
{
type: "doc",
docId: "advanced-options/readme",
position: "left",
label: "Advanced options",
},
{
type: "doc",
docId: "developer-guide/readme",
position: "left",
label: "Developer Guide",
},
{
label: "Download",
href: "/download",
},
{
href: "https://github.com/qdraw/starsky",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
title: "Docs",
items: [
{
type: "doc",
docId: "developer-guide/readme",
position: "left",
label: "Developer Guide",
label: "Getting started",
to: "/docs/getting-started",
},
{
label: "Download",
href: "/download",
label: "All features",
to: "/docs/features",
},
{
href: "https://github.com/qdraw/starsky",
label: "GitHub",
position: "right",
label: "Application Blog",
to: "/blog",
},
],
},
footer: {
style: "dark",
links: [
],
},
{
title: "Community",
items: [
{
title: "Docs",
items: [
{
label: "Getting started",
to: "/docs/getting-started",
},
{
label: "All features",
to: "/docs/features",
},
{
label: "Application Blog",
to: "/blog",
},
],
label: "Discussions",
href: "https://github.com/qdraw/starsky/discussions",
},
],
},
{
title: "More",
items: [
{
title: "Community",
items: [
{
label: "Discussions",
href: "https://github.com/qdraw/starsky/discussions",
},
],
label: "Qdraw Blog (in Dutch)",
to: "https://qdraw.nl/blog/",
},
{
title: "More",
items: [
{
label: "Qdraw Blog (in Dutch)",
to: "https://qdraw.nl/blog/",
},
{
label: "GitHub",
href: "https://github.com/qdraw/starsky",
},
],
label: "GitHub",
href: "https://github.com/qdraw/starsky",
},
],
copyright: `Copyright © ${new Date().getFullYear()} Starsky`,
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Starsky`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
};
Expand Down
Loading

0 comments on commit cb5e866

Please sign in to comment.