Deploy Hugo static websites to AWS
Project description
CDK-Hugo-Deploy
This is an AWS CDK Construct for easily deploying Hugo Static websites to AWS S3 behind SSL/Cloudfront.
Usage
Before deploying, run the hugo
command in your Hugo project to generate a built site in the public
directory.
import { App, Stack, StackProps } from 'aws-cdk-lib';
import { HugoDeploy } from 'cdk-hugo-deploy';
export class MyStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
new HugoDeploy(this, 'HugoDeploy', {
publicDir: 'path/to/hugo-project/public',
domainName: 'example.com' // Domain you already have a hosted zone for
});
}
Prerequisites
Assumes that there is already a Route53 hosted zone for domainName
that can be looked up
Why this construct?
Other constructs for deploying Single Page Applicationis (SPA) such as CDK-SPA-Deploy don't account for how Hugo handles paths that end in /
.
This construct includes a Cloudfront Function to rewrite paths to ensure /path/to/page/
will request /path/to/page/index.html
from the S3 Origin.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cdk-hugo-deploy-0.0.16.tar.gz
(30.6 kB
view hashes)
Built Distribution
Close
Hashes for cdk_hugo_deploy-0.0.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ade4c3d6f77b88849d1b12e25863e878c83ca6e89cb81627793cc9c093d35cb |
|
MD5 | 9b38a2d23cceeb3c13a86dadaab5adc6 |
|
BLAKE2b-256 | cac062d95688b465c67b49044024408f7505b702eec3b7a91e46addc0b19b60b |