From d5542ed286746e89fb13a1f821d4955ace371773 Mon Sep 17 00:00:00 2001 From: Dietrich Epp Date: Tue, 18 Jun 2024 14:26:08 -0400 Subject: deploy: Add stripIndexHtml target option This new configuration parameter causes paths matching "/index.html" to be stored as "/" remotely. This simplifies the cloud configuration needed for some use cases, such as CloudFront distributions with S3 bucket origins. Before this change, users must configure their S3 buckets as public websites (which is incompatible with certain authentication / authorization schemes), or users must add a CloudFormation function to add index.html to the end of incoming requests. After this change, users can simply use an ordinary CloudFront distribution (no additional code) with an ordinary S3 bucket origin (and not an S3 website). This adds tests to ensure that functionality like matchers is unaffected by this change. I have also tested that the functionality works as expected when deploying to a real S3 / CloudFront website. Closes #12607 --- docs/content/en/hosting-and-deployment/hugo-deploy.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/content') diff --git a/docs/content/en/hosting-and-deployment/hugo-deploy.md b/docs/content/en/hosting-and-deployment/hugo-deploy.md index 45b917f1e..db2448ee7 100644 --- a/docs/content/en/hosting-and-deployment/hugo-deploy.md +++ b/docs/content/en/hosting-and-deployment/hugo-deploy.md @@ -186,6 +186,15 @@ URL = "" #include = "**.html" # would only include files with ".html" suffix #exclude = "**.{jpg, png}" # would exclude files with ".jpg" or ".png" suffix +# Map any file named "/index.html" to the remote file "/". This does +# not affect the root "index.html" file, and it does not affect matchers below. +# This works when deploying to key-value cloud storage systems, such as Amazon +# S3 (general purpose buckets, not directory buckets), Google Cloud Storage, and +# Azure Blob Storage. This makes it so the canonical URL will match the object +# key in cloud storage, except for the root index.html file. +# +#stripIndexHTML = true + ####################### [[deployment.matchers]] @@ -195,6 +204,7 @@ URL = "" # See https://golang.org/pkg/regexp/syntax/ for pattern syntax. # Pattern searching is stopped on first match. +# This is not affected by stripIndexHTML, above. pattern = "" # If true, Hugo will gzip the file before uploading it to the bucket. -- cgit v1.2.3