diff --git a/.circleci/config.yml b/.circleci/config.yml index 1db280c45..c14df897d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,7 +41,7 @@ jobs: - /home/circleci/bin - run: name: Hugo Build - command: npx hugo --logLevel info --minify --destination workspace/public + command: npx hugo --config config/production/config.yml --logLevel info --minify --destination workspace/public - persist_to_workspace: root: workspace paths: diff --git a/config/production/config.yml b/config/production/config.yml new file mode 100644 index 000000000..0dc30871b --- /dev/null +++ b/config/production/config.yml @@ -0,0 +1,25 @@ +# Production overrides for CI/CD builds +baseURL: 'https://docs.influxdata.com/' + +# Production environment parameters +params: + env: production + environment: production + +# Enable minification for production +minify: + disableJS: false + disableCSS: false + disableHTML: false + minifyOutput: true + +# Production asset processing +build: + writeStats: false + useResourceCacheWhen: "always" + buildOptions: + sourcemap: false + target: "es2015" + +# Disable development server settings +server: {} \ No newline at end of file diff --git a/config/testing/config.yml b/config/testing/config.yml index f403c8347..12d2cfd14 100644 --- a/config/testing/config.yml +++ b/config/testing/config.yml @@ -1,20 +1,111 @@ baseURL: 'http://localhost:1315/' +languageCode: en-us +title: InfluxDB Documentation -server: - port: 1315 +# Git history information for lastMod-type functionality +enableGitInfo: true + +# Syntax Highlighting +pygmentsCodefences: true +pygmentsUseClasses: true + +# Preserve case in article tags +preserveTaxonomyNames: true + +# Generate a robots.txt +enableRobotsTXT: true # Override settings for testing buildFuture: true # Configure what content is built in testing env params: + env: testing environment: testing buildTestContent: true - + +# Server configuration for testing +server: + port: 1315 + baseURL: 'http://localhost:1315/' + watchChanges: true + disableLiveReload: false + # Keep your shared content exclusions ignoreFiles: - "content/shared/.*" # Ignore specific warning logs ignoreLogs: - - warning-goldmark-raw-html \ No newline at end of file + - warning-goldmark-raw-html + +# Markdown rendering options +blackfriday: + hrefTargetBlank: true + smartDashes: false + +# Copy taxonomies from main config +taxonomies: + influxdb/v2/tag: influxdb/v2/tags + influxdb/cloud/tag: influxdb/cloud/tags + influxdb3/cloud-serverless/tag: influxdb/cloud-serverless/tags + influxdb3/cloud-dedicated/tag: influxdb/cloud-dedicated/tags + influxdb3/clustered/tag: influxdb3/clustered/tags + influxdb3/core/tag: influxdb3/core/tags + influxdb3/enterprise/tag: influxdb3/enterprise/tags + flux/v0/tag: flux/v0/tags + +# Markup configuration +markup: + goldmark: + renderer: + unsafe: true + extensions: + linkify: false + parser: + attribute: + block: true + +# Privacy settings +privacy: + googleAnalytics: + anonymizeIP: false + disable: false + respectDoNotTrack: true + useSessionStorage: false + youtube: + disable: false + privacyEnhanced: true + +# Output formats +outputFormats: + json: + mediaType: application/json + baseName: pages + isPlainText: true + +# Asset processing for testing (disable minification) +build: + writeStats: true + useResourceCacheWhen: "fallback" + buildOptions: + sourcemap: "inline" + target: "es2020" + +# Disable minification for testing +minify: + disableJS: true + disableCSS: true + disableHTML: true + minifyOutput: false + +# Asset processing configuration +assetDir: "assets" + +# Module mounts +module: + mounts: + - source: assets + target: assets + - source: node_modules + target: assets/node_modules \ No newline at end of file diff --git a/hugo.staging.yml b/hugo.staging.yml index dd936bf3a..f5ad41bb9 100644 --- a/hugo.staging.yml +++ b/hugo.staging.yml @@ -17,7 +17,26 @@ enableRobotsTXT: true # Custom staging params params: + env: staging environment: staging +server: + disableLiveReload: true + +# Staging uses the same asset processing as production +# Enable minification for staging +minify: + disableJS: false + disableCSS: false + disableHTML: false + minifyOutput: true + +# Staging asset processing +build: + writeStats: false + useResourceCacheWhen: "always" + buildOptions: + sourcemap: false + target: "es2015" # Markdown rendering options blackfriday: diff --git a/hugo.yml b/hugo.yml index 44345b0ab..3b34115e8 100644 --- a/hugo.yml +++ b/hugo.yml @@ -55,10 +55,16 @@ outputFormats: baseName: pages isPlainText: true +# Asset processing configuration for development build: - # Configure JavaScript build settings for ES6 modules writeStats: true useResourceCacheWhen: "fallback" + # Enable source maps for debugging + buildOptions: + sourcemap: "inline" + target: "es2020" + # Disable asset bundling in development + noJSConfigInAssets: false # Asset processing configuration assetDir: "assets" @@ -70,11 +76,22 @@ module: - source: node_modules target: assets/node_modules -# Ensure proper JavaScript processing in development -minify: - disableJS: true - minifyOutput: false - # Development settings params: - env: development \ No newline at end of file + env: development + environment: development + +# Configure the server for development +# Specify the port for development to avoid conflicts with testing +server: + port: 1313 + baseURL: 'http://localhost:1313/' + watchChanges: true + disableLiveReload: false + +# Disable minification and bundling for development +minify: + disableJS: true + disableCSS: true + disableHTML: true + minifyOutput: false diff --git a/layouts/partials/header/javascript.html b/layouts/partials/header/javascript.html index 2c3f80449..bb45dee8f 100644 --- a/layouts/partials/header/javascript.html +++ b/layouts/partials/header/javascript.html @@ -12,21 +12,60 @@ {{ end -}} {{ $products := .Site.Data.products }} {{ $influxdb_urls := .Site.Data.influxdb_urls }} - -{{ with resources.Get "js/main.js" }} - {{ $opts := dict - "minify" hugo.IsProduction - "sourceMap" (cond hugo.IsProduction "" "external") - "targetPath" "js/main.js" - "params" (dict "product" $product "currentVersion" $currentVersion "isServer" hugo.IsServer "products" $products "influxdb_urls" $influxdb_urls "cloudUrls" $cloudUrls) - }} - {{ with . | js.Build $opts }} - {{ if hugo.IsProduction }} - {{ with . | fingerprint }} - - {{ end }} - {{ else }} + +{{ $isDevelopmentOrTesting := or (eq .Site.Params.environment "development") (eq .Site.Params.environment "testing") (eq (getenv "HUGO_ENV") "development") (eq (getenv "HUGO_ENV") "testing") (not hugo.IsProduction) }} + +{{ if $isDevelopmentOrTesting }} + {{/* Load individual JS files for debugging */}} + {{ $sharedParams := dict "product" $product "currentVersion" $currentVersion "isServer" hugo.IsServer "products" $products "influxdb_urls" $influxdb_urls "cloudUrls" $cloudUrls }} + + {{/* Load main.js first to ensure proper initialization */}} + {{ with resources.Get "js/main.js" }} + {{ $opts := dict + "minify" false + "sourceMap" "inline" + "targetPath" "js/main.js" + "params" $sharedParams + }} + {{ with . | js.Build $opts }} {{ end }} {{ end }} -{{ end }} + + {{/* Load other individual JS files for debugging */}} + {{ range $file := (readDir "assets/js") }} + {{ if and (strings.HasSuffix $file.Name ".js") (ne $file.Name "main.js") }} + {{ $jsPath := printf "js/%s" $file.Name }} + {{ with resources.Get $jsPath }} + {{ $opts := dict + "minify" false + "sourceMap" "inline" + "targetPath" $jsPath + "params" $sharedParams + }} + {{ with . | js.Build $opts }} + + {{ end }} + {{ end }} + {{ end }} + {{ end }} +{{ else }} + {{/* Non-development environment: Bundle everything */}} + {{ with resources.Get "js/main.js" }} + {{ $opts := dict + "minify" hugo.IsProduction + "sourceMap" (cond hugo.IsProduction "" "external") + "targetPath" "js/main.js" + "params" (dict "product" $product "currentVersion" $currentVersion "isServer" hugo.IsServer "products" $products "influxdb_urls" $influxdb_urls "cloudUrls" $cloudUrls) + }} + {{ with . | js.Build $opts }} + {{ if hugo.IsProduction }} + {{ with . | fingerprint }} + + {{ end }} + {{ else }} + + {{ end }} + {{ end }} + {{ end }} +{{ end }} \ No newline at end of file