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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pnpm fix:format # auto-format
```

Each app also works on its own: `cd apps/docs && pnpm dev`. Copy `apps/<app>/.env.example` to
`apps/<app>/.env` for Algolia / PostHog keys (both are optional — search falls back to local search).
`apps/<app>/.env` to configure optional Algolia credentials; without them, search falls back to local search.

## Repository layout

Expand Down
3 changes: 0 additions & 3 deletions apps/developer-docs/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# PostHog Analytics
VITE_POSTHOG_KEY=

# Algolia Search
VITE_ALGOLIA_APP_ID=
VITE_ALGOLIA_API_KEY=
Expand Down
17 changes: 0 additions & 17 deletions apps/developer-docs/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function loadEnvVar(key: string): string | undefined {
}
}

const posthogKey = loadEnvVar("VITE_POSTHOG_KEY");
const algoliaAppId = loadEnvVar("VITE_ALGOLIA_APP_ID");
const algoliaApiKey = loadEnvVar("VITE_ALGOLIA_API_KEY");
const algoliaIndexName = loadEnvVar("VITE_ALGOLIA_INDEX_NAME");
Expand All @@ -38,19 +37,6 @@ const searchConfig =
}
: { provider: "local" as const };

const posthogHead: HeadConfig[] = posthogKey
? [
[
"script",
{},
`
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init capture register register_once register_for_session unregister unregister_for_session getFeatureFlag getFeatureFlagPayload isFeatureEnabled reloadFeatureFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey getNextSurveyStep identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException loadToolbar get_property getSessionProperty createPersonProfile opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing clear_opt_in_out_capturing debug getPageViewId captureTraceFeedback captureTraceMetric".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('${posthogKey}',{api_host:'https://us.posthog.com', opt_out_capturing_by_default: true, persistence: 'memory'});
`,
],
]
: [];

export default extendConfig(
withMermaid(
defineConfig({
Expand Down Expand Up @@ -181,9 +167,6 @@ export default extendConfig(
gtag('config', 'G-JF828SKW90');`,
],

// PostHog Analytics (loaded only when VITE_POSTHOG_KEY is set)
...posthogHead,

// SEO: Basic meta tags
["meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }],
["meta", { name: "author", content: "Plane" }],
Expand Down
1 change: 0 additions & 1 deletion apps/docs/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
VITE_ALGOLIA_APP_ID=
VITE_ALGOLIA_API_KEY=
VITE_ALGOLIA_INDEX_NAME=
VITE_POSTHOG_KEY=
24 changes: 1 addition & 23 deletions apps/docs/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { copyFileSync, mkdirSync, readFileSync, readdirSync, statSync } from "fs";
import { dirname, join, relative, resolve } from "path";
import { defineConfig, type HeadConfig } from "vitepress";
import { defineConfig } from "vitepress";
import { extendConfig } from "@voidzero-dev/vitepress-theme/config";
import { tabsMarkdownPlugin } from "vitepress-plugin-tabs";
import llmstxt from "vitepress-plugin-llms";
Expand All @@ -20,22 +20,10 @@ function loadEnvVar(key: string): string | undefined {
}
}

const posthogKey = loadEnvVar("VITE_POSTHOG_KEY");
const algoliaAppId = loadEnvVar("VITE_ALGOLIA_APP_ID");
const algoliaApiKey = loadEnvVar("VITE_ALGOLIA_API_KEY");
const algoliaIndexName = loadEnvVar("VITE_ALGOLIA_INDEX_NAME");

const posthogHead: HeadConfig[] = posthogKey
? [
[
"script",
{},
`!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('${posthogKey}', {api_host: 'https://us.i.posthog.com', person_profiles: 'identified_only', opt_out_capturing_by_default: true, persistence: 'memory'});`,
],
]
: [];

const searchConfig =
algoliaAppId && algoliaApiKey && algoliaIndexName
? {
Expand Down Expand Up @@ -136,14 +124,6 @@ const config = defineConfig({
crossorigin: "anonymous",
},
],
[
"script",
{
src: "https://plausible.io/js/script.js",
defer: "true",
"data-domain": "docs.plane.so",
},
],
// Google Analytics with Consent Mode v2 (granted via the cookie banner)
[
"script",
Expand All @@ -166,8 +146,6 @@ const config = defineConfig({
gtag('js', new Date());
gtag('config', 'G-G578SD4VZD');`,
],
// PostHog (conditionally injected)
...posthogHead,
[
"script",
{
Expand Down
25 changes: 1 addition & 24 deletions packages/theme/src/components/CookieConsent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { ref, onMounted } from "vue";
declare global {
interface Window {
gtag?: (...args: any[]) => void;
posthog?: {
opt_in_capturing?: () => void;
opt_out_capturing?: () => void;
};
}
}

Expand All @@ -31,22 +27,6 @@ function grantConsent() {
analytics_storage: "granted",
});
}

// PostHog (may not be loaded if VITE_POSTHOG_KEY is unset)
if (window.posthog?.opt_in_capturing) {
window.posthog.opt_in_capturing();
}
}

function denyConsent() {
if (typeof window === "undefined") return;

// Google Analytics — consent stays denied by default, no update needed

// PostHog (may not be loaded if VITE_POSTHOG_KEY is unset)
if (window.posthog?.opt_out_capturing) {
window.posthog.opt_out_capturing();
}
}

function accept() {
Expand All @@ -61,17 +41,14 @@ function decline() {
try {
localStorage.setItem(STORAGE_KEY, "denied");
} catch {}
denyConsent();
showBanner.value = false;
}

onMounted(() => {
const consent = getConsent();
if (consent === "granted") {
grantConsent();
} else if (consent === "denied") {
denyConsent();
} else {
} else if (consent !== "denied") {
showBanner.value = true;
}
});
Expand Down
Loading