Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Prune docs tooling comments

Manav Rathie610eb7cf601
diff --git a/docs/.gitignore b/docs/.gitignore
index 3026e9d994..fce5a6dc72 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -1,4 +1,2 @@
-# VitePress dev server cache
/docs/.vitepress/cache/
-# VitePress production build
/docs/.vitepress/dist/
diff --git a/docs/docs/.vitepress/config.ts b/docs/docs/.vitepress/config.ts
index 9e85062904..b1447de2d5 100644
--- a/docs/docs/.vitepress/config.ts
+++ b/docs/docs/.vitepress/config.ts
@@ -3,12 +3,10 @@ import { sidebar } from "./sidebar";
const docsBaseUrl = "https://ente.com/help";
-// Pages with noindex in frontmatter, collected during build to exclude from sitemap
const noindexPages = new Set<string>();
-// https://vitepress.dev/reference/site-config
export default defineConfig({
- base: "/help/", // Serve under /help path
+ base: "/help/",
title: "Ente Help",
description: "Documentation and help for Ente's products",
head: [
@@ -19,8 +17,6 @@ export default defineConfig({
sitemap: {
hostname: `${docsBaseUrl}/`,
transformItems: (items) => {
- // Remove trailing slashes for consistency (cleanUrls is enabled)
- // and deduplicate URLs
const seen = new Set();
return items
.map((item) => ({
@@ -41,7 +37,6 @@ export default defineConfig({
},
},
transformPageData(pageData) {
- // Track noindex pages for sitemap exclusion
const head = pageData.frontmatter.head;
if (Array.isArray(head)) {
for (const tag of head) {
@@ -60,7 +55,6 @@ export default defineConfig({
}
}
- // Add canonical URL to all pages
const canonicalUrl = `${docsBaseUrl}/${pageData.relativePath}`
.replace(/index\.md$/, "")
.replace(/\.md$/, "");
@@ -75,12 +69,10 @@ export default defineConfig({
const description =
pageData.frontmatter.description ||
"Documentation and help for Ente's products";
- const ogImage = `${docsBaseUrl}/og-image.png`; // You can customize this per page if needed
+ const ogImage = `${docsBaseUrl}/og-image.png`;
- // Canonical URL
head.push(["link", { rel: "canonical", href: canonicalUrl }]);
- // Open Graph tags
head.push(["meta", { property: "og:type", content: "website" }]);
head.push(["meta", { property: "og:title", content: title }]);
head.push([
@@ -91,7 +83,6 @@ export default defineConfig({
head.push(["meta", { property: "og:image", content: ogImage }]);
head.push(["meta", { property: "og:site_name", content: "Ente Help" }]);
- // Twitter Card tags
head.push([
"meta",
{ name: "twitter:card", content: "summary_large_image" },
@@ -104,10 +95,8 @@ export default defineConfig({
]);
head.push(["meta", { name: "twitter:image", content: ogImage }]);
- // Meta description
head.push(["meta", { name: "description", content: description }]);
- // Add FAQ Schema markup for FAQ pages
if (
pageData.relativePath.includes("/faq/") &&
pageData.relativePath !== "photos/faq/index.md"
@@ -122,7 +111,6 @@ export default defineConfig({
}
}
- // Add BreadcrumbList schema for better navigation
const breadcrumbSchema = generateBreadcrumbSchema(pageData);
if (breadcrumbSchema) {
head.push([
@@ -135,10 +123,6 @@ export default defineConfig({
return head;
},
themeConfig: {
- // We use the default theme (with some CSS color overrides). This
- // themeConfig block can be used to further customize the default theme.
- //
- // https://vitepress.dev/reference/default-theme-config
logo: "/logo.png",
externalLinkIcon: true,
editLink: {
@@ -162,20 +146,17 @@ export default defineConfig({
},
});
-// Generate FAQ Schema for FAQ pages
async function generateFAQSchema(pageData: any) {
try {
const { readFile } = await import("fs/promises");
const { join } = await import("path");
- // Read the actual markdown file
const filePath = join(process.cwd(), "docs", pageData.relativePath);
const content = await readFile(filePath, "utf-8");
const questions: any[] = [];
- // Match headings with IDs (format: ### Question {#id})
- // Updated regex to better match the content structure
+ // FAQ entries use ### Question {#id} headings.
const questionRegex =
/###\s+(.+?)\s+\{#[^}]+\}\s*\n+([\s\S]*?)(?=\n###\s|\n##\s|$)/g;
let match;
@@ -184,21 +165,19 @@ async function generateFAQSchema(pageData: any) {
const question = match[1].trim();
let answer = match[2]
.trim()
- // Remove markdown formatting
- .replace(/\*\*([^*]+)\*\*/g, "$1") // Bold
- .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1") // Links
- .replace(/`([^`]+)`/g, "$1") // Inline code
+ .replace(/\*\*([^*]+)\*\*/g, "$1")
+ .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1")
+ .replace(/`([^`]+)`/g, "$1")
.replace(
/^\s*>\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/gim,
"",
- ) // GitHub alert labels
- .replace(/^\s*>\s?/gm, "") // Blockquotes
- .replace(/^[-*]\s+/gm, "") // List items
- .replace(/\n+/g, " ") // Newlines to spaces
- .replace(/\s+/g, " ") // Multiple spaces to single
+ )
+ .replace(/^\s*>\s?/gm, "")
+ .replace(/^[-*]\s+/gm, "")
+ .replace(/\n+/g, " ")
+ .replace(/\s+/g, " ")
.trim();
- // Limit answer length but try to end at a sentence
if (answer.length > 500) {
answer = answer.substring(0, 500);
const lastPeriod = answer.lastIndexOf(".");
@@ -237,7 +216,6 @@ async function generateFAQSchema(pageData: any) {
}
}
-// Generate Breadcrumb Schema
function generateBreadcrumbSchema(pageData: any) {
const path = pageData.relativePath
.replace(/\.md$/, "")
diff --git a/docs/docs/.vitepress/sidebar.ts b/docs/docs/.vitepress/sidebar.ts
index 23045f98a4..23d0064e51 100644
--- a/docs/docs/.vitepress/sidebar.ts
+++ b/docs/docs/.vitepress/sidebar.ts
@@ -1,5 +1,4 @@
-// When adding new pages, they need to be manually inserted into their
-// appropriate place here.
+// Add new pages to this sidebar manually.
export const sidebar = [
{
diff --git a/docs/docs/.vitepress/theme/custom.css b/docs/docs/.vitepress/theme/custom.css
index 94725e4abb..cfadcf6bd9 100644
--- a/docs/docs/.vitepress/theme/custom.css
+++ b/docs/docs/.vitepress/theme/custom.css
@@ -18,7 +18,6 @@
--docsearch-hit-active-color: #191919;
}
-/* Increase H3 spacing for better readability, especially in FAQ pages */
.vp-doc h3 {
margin-top: 48px;
}