Socket
Socket
Sign inDemoInstall

cdk-hugo-deploy

Package Overview
Dependencies
41
Maintainers
1
Versions
443
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cdk-hugo-deploy

Deploy Hugo static websites to AWS


Version published
Weekly downloads
36
increased by28.57%
Maintainers
1
Install size
156 kB
Created
Weekly downloads
 

Readme

Source

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.

Typescript

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
    });
}

Python

from constructs import Construct
from aws_cdk import Stack
from cdk_hugo_deploy import HugoDeploy

class MyStack(Stack):
    def __init__(self, scope: Construct, id: str, **kwargs):
        super().__init__(scope, id, **kwargs)

        HugoDeploy(self, "HugoDeploy",
            public_dir="path/to/hugo-project/public",
            domain_name="example.com"
        )

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.

Contributing

Please open an issue with any updates/features you'd like on this

Keywords

FAQs

Last updated on 21 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc