# CDK-Hugo-Deploy
This is an AWS CDK Construct for easily deploying [Hugo](https://gohugo.io/) 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
```python
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
```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](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53.HostedZone.html#static-fromwbrlookupscope-id-query)
## Why this construct?
Other constructs for deploying Single Page Applicationis (SPA) such as [CDK-SPA-Deploy](https://github.com/nideveloper/CDK-SPA-Deploy) don't account for how Hugo handles paths that end in `/`.
This construct includes a [Cloudfront Function](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-functions.html) to [rewrite paths](src/hugoPaths.js) to ensure `/path/to/page/` will request `/path/to/page/index.html` from the S3 Origin.
## Contributing
Please open an [issue](https://github.com/maafk/cdk-hugo-deploy/issues) with any updates/features you'd like on this
Raw data
{
"_id": null,
"home_page": "https://github.com/maafk/cdk-hugo-deploy.git",
"name": "cdk-hugo-deploy",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Taylor Ondrey<taylor@taylorondrey.com>",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/53/ee/aaa65c89a62089ee8a1128be4ae160141fee1f84d4da48ff9799b5e19ee7/cdk-hugo-deploy-0.0.440.tar.gz",
"platform": null,
"description": "# CDK-Hugo-Deploy\n\nThis is an AWS CDK Construct for easily deploying [Hugo](https://gohugo.io/) Static websites to AWS S3 behind SSL/Cloudfront.\n\n## Usage\n\nBefore deploying, run the `hugo` command in your Hugo project to generate a built site in the `public` directory.\n\n## Typescript\n\n```python\nimport { App, Stack, StackProps } from 'aws-cdk-lib';\nimport { HugoDeploy } from 'cdk-hugo-deploy';\n\nexport class MyStack extends Stack {\n constructor(scope: Construct, id: string, props?: StackProps) {\n super(scope, id, props);\n\n new HugoDeploy(this, 'HugoDeploy', {\n publicDir: 'path/to/hugo-project/public',\n domainName: 'example.com' // Domain you already have a hosted zone for\n });\n}\n```\n\n## Python\n\n```python\nfrom constructs import Construct\nfrom aws_cdk import Stack\nfrom cdk_hugo_deploy import HugoDeploy\n\nclass MyStack(Stack):\n def __init__(self, scope: Construct, id: str, **kwargs):\n super().__init__(scope, id, **kwargs)\n\n HugoDeploy(self, \"HugoDeploy\",\n public_dir=\"path/to/hugo-project/public\",\n domain_name=\"example.com\"\n )\n```\n\n## Prerequisites\n\nAssumes that there is already a Route53 hosted zone for `domainName` that can be [looked up](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53.HostedZone.html#static-fromwbrlookupscope-id-query)\n\n## Why this construct?\n\nOther constructs for deploying Single Page Applicationis (SPA) such as [CDK-SPA-Deploy](https://github.com/nideveloper/CDK-SPA-Deploy) don't account for how Hugo handles paths that end in `/`.\n\nThis construct includes a [Cloudfront Function](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-functions.html) to [rewrite paths](src/hugoPaths.js) to ensure `/path/to/page/` will request `/path/to/page/index.html` from the S3 Origin.\n\n## Contributing\n\nPlease open an [issue](https://github.com/maafk/cdk-hugo-deploy/issues) with any updates/features you'd like on this\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Deploy Hugo static websites to AWS",
"version": "0.0.440",
"project_urls": {
"Homepage": "https://github.com/maafk/cdk-hugo-deploy.git",
"Source": "https://github.com/maafk/cdk-hugo-deploy.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "aedb98b386d7997592c9a1e879b9d3818ac5b298aa33194eb54a6bc3bd4fb66c",
"md5": "2507581cedcc56c33453aba3333bb128",
"sha256": "fbef36dab0a400f7b263824b8d794b6dad67bd20c557c3585bdc283336cba572"
},
"downloads": -1,
"filename": "cdk_hugo_deploy-0.0.440-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2507581cedcc56c33453aba3333bb128",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 32364,
"upload_time": "2024-03-17T01:02:08",
"upload_time_iso_8601": "2024-03-17T01:02:08.818633Z",
"url": "https://files.pythonhosted.org/packages/ae/db/98b386d7997592c9a1e879b9d3818ac5b298aa33194eb54a6bc3bd4fb66c/cdk_hugo_deploy-0.0.440-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "53eeaaa65c89a62089ee8a1128be4ae160141fee1f84d4da48ff9799b5e19ee7",
"md5": "c2076b436ac3cb3ddb510a0b64286e1e",
"sha256": "5383a1faf92e21cb28e6ed44f47d6ef1958480b9b6c4a9e2f5e18bc8d1f55855"
},
"downloads": -1,
"filename": "cdk-hugo-deploy-0.0.440.tar.gz",
"has_sig": false,
"md5_digest": "c2076b436ac3cb3ddb510a0b64286e1e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 33748,
"upload_time": "2024-03-17T01:02:13",
"upload_time_iso_8601": "2024-03-17T01:02:13.210515Z",
"url": "https://files.pythonhosted.org/packages/53/ee/aaa65c89a62089ee8a1128be4ae160141fee1f84d4da48ff9799b5e19ee7/cdk-hugo-deploy-0.0.440.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-17 01:02:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "maafk",
"github_project": "cdk-hugo-deploy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cdk-hugo-deploy"
}