From ec422e32235fe418d56bad7226dd5e98a9f00b41 Mon Sep 17 00:00:00 2001 From: Josh Heyer Date: Tue, 14 Jan 2025 16:32:02 +0000 Subject: [PATCH] Misc corrections: - Fix paths for PDF generation - Specify product name for cloud service - Don't no-index main! - Exclude stub products --- .github/workflows/build-pages.yml | 2 +- .../edb-postgres-ai/cloud-service/index.mdx | 1 + product_docs/docs/net_connector/4.0.10.1/index.mdx | 1 - product_docs/docs/net_connector/4.0.6.1/index.mdx | 1 - product_docs/docs/net_connector/4.1.3.1/index.mdx | 1 - product_docs/docs/net_connector/4.1.5.1/index.mdx | 1 - scripts/pdf/generate_pdf.py | 12 +++++++----- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-pages.yml b/.github/workflows/build-pages.yml index 4862b879ffa..ab1b43dc792 100644 --- a/.github/workflows/build-pages.yml +++ b/.github/workflows/build-pages.yml @@ -90,7 +90,7 @@ jobs: - name: Gatsby build run: npm run build env: - APP_ENV: ${{ inputs.ref == 'main' && 'production' || 'staging' }} + APP_ENV: ${{ inputs.ref == 'refs/heads/main' && 'production' || 'staging' }} NODE_ENV: ${{ vars.NODE_ENV }} NODE_OPTIONS: --max-old-space-size=4096 FATHOM_SITE_ID: ${{ vars.FATHOM_SITE_ID }} diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/index.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/index.mdx index 774890247d0..22f4c49fa86 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/index.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/index.mdx @@ -4,6 +4,7 @@ navTitle: Cloud Service description: An introduction to the EDB Postgres AI Cloud Service and its features. directoryDefaults: displayBanner: "Notice: EDB will no longer offer theĀ  Hosted Cloud Service option for new customers. However, support will remain available for existing customers of the EDB Hosted plan. The associated documentation topics will soon be removed, and updates regarding the removal process will be shared as they become available. The 'Your Cloud Account' option will continue to be available." + product: "EDB Postgres AI Cloud Service" navigation: - getting_started - using_cluster diff --git a/product_docs/docs/net_connector/4.0.10.1/index.mdx b/product_docs/docs/net_connector/4.0.10.1/index.mdx index 51f022aaa7d..d2bf94255c1 100644 --- a/product_docs/docs/net_connector/4.0.10.1/index.mdx +++ b/product_docs/docs/net_connector/4.0.10.1/index.mdx @@ -11,7 +11,6 @@ legacyRedirectsGenerated: - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.0.10.1/genindex.html" - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.0.10.1/whats_new.html" - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.0.10.1/index.html" -pdf: true --- diff --git a/product_docs/docs/net_connector/4.0.6.1/index.mdx b/product_docs/docs/net_connector/4.0.6.1/index.mdx index 2b856ec9845..3637ba4af5a 100644 --- a/product_docs/docs/net_connector/4.0.6.1/index.mdx +++ b/product_docs/docs/net_connector/4.0.6.1/index.mdx @@ -11,7 +11,6 @@ legacyRedirectsGenerated: - "/edb-docs/p/edb-postgres-net-connector/4.0.6.1" - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.0.6.1/genindex.html" - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.0.6.1/index.html" -pdf: true --- diff --git a/product_docs/docs/net_connector/4.1.3.1/index.mdx b/product_docs/docs/net_connector/4.1.3.1/index.mdx index f5363261fa7..d1983bf1818 100644 --- a/product_docs/docs/net_connector/4.1.3.1/index.mdx +++ b/product_docs/docs/net_connector/4.1.3.1/index.mdx @@ -11,7 +11,6 @@ legacyRedirectsGenerated: - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.1.3.1/genindex.html" - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.1.3.1/conclusion.html" - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.1.3.1/index.html" -pdf: true --- diff --git a/product_docs/docs/net_connector/4.1.5.1/index.mdx b/product_docs/docs/net_connector/4.1.5.1/index.mdx index e2fac8fda32..dad52c0d343 100644 --- a/product_docs/docs/net_connector/4.1.5.1/index.mdx +++ b/product_docs/docs/net_connector/4.1.5.1/index.mdx @@ -11,7 +11,6 @@ legacyRedirectsGenerated: - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.1.5.1/genindex.html" - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.1.5.1/conclusion.html" - "/edb-docs/d/edb-postgres-net-connector/user-guides/net-guide/4.1.5.1/index.html" -pdf: true --- diff --git a/scripts/pdf/generate_pdf.py b/scripts/pdf/generate_pdf.py index 12d6d9cbc02..f118da94f01 100755 --- a/scripts/pdf/generate_pdf.py +++ b/scripts/pdf/generate_pdf.py @@ -143,8 +143,9 @@ def main(args): def setup(args): doc_path = args.doc_path index_meta = load_index_metadata(doc_path) - product = index_meta.get("product", None) or doc_path.parts[-2] if len(doc_path.parts) >= 4 else doc_path.parts[-1] - version = index_meta.get("version", None) or doc_path.parts[-1] if len(doc_path.parts) >= 4 else '' + directoryDefaults = index_meta.get("directoryDefaults", None) or {} + product = directoryDefaults.get("product", None) or index_meta.get("product", None) or (doc_path.parts[-2] if len(doc_path.parts) >= 4 else doc_path.parts[-1]) + version = directoryDefaults.get("version", None) or index_meta.get("version", None) or (doc_path.parts[-1] if len(doc_path.parts) >= 4 else '') _file_prefix = product + (version and "_v" + version or "") + "_documentation" @@ -199,7 +200,7 @@ def hash_check(pdf_file, pdf_hash_file, mdx_file): if pdf_file.exists() and newHash == existingHash: return True - pdf_file.unlink() + pdf_file.unlink(missing_ok=True) pdf_hash_file.write_text(newHash) return False @@ -270,8 +271,9 @@ def parse_mdx(mdx_file): def load_index_metadata(path): try: - indexMeta = frontmatter.load(path / "index.mdx") - return indexMeta + with open(path / "index.mdx") as indexFile: + indexMeta, content = frontmatter.parse(indexFile.read()) + return indexMeta except (FileNotFoundError): return {}