mirror of
https://github.com/dataforcanada/d4c-service-main-site.git
synced 2026-06-13 14:00:51 +02:00
Initial commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"image": "mcr.microsoft.com/devcontainers/go:1",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/hugo:1": {
|
||||
"extended": true,
|
||||
"version": "0.147.7"
|
||||
},
|
||||
"ghcr.io/devcontainers/features/node:1": {}
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"mhutchie.git-graph",
|
||||
"esbenp.prettier-vscode",
|
||||
"tamasfe.even-better-toml",
|
||||
"budparr.language-hugo-vscode"
|
||||
]
|
||||
}
|
||||
},
|
||||
"forwardPorts": [
|
||||
1313
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
# Hugo output
|
||||
public/
|
||||
resources/
|
||||
.hugo_build.lock
|
||||
# Worker
|
||||
node_modules/
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Data for Canada
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,29 @@
|
||||
## Table of Contents
|
||||
- [About](#about)
|
||||
- [How to Run Locally](#how-to-run-locally)
|
||||
- [License](#license)
|
||||
|
||||
## About
|
||||
[](https://github.com/dataforcanada/www.dataforcanada.org/actions/workflows/deploy_website.yaml)
|
||||
[](https://github.com/dataforcanada/www.dataforcanada.org/actions/workflows/deploy_worker.yaml)
|
||||
|
||||
This repo has the code for my personal website, [www.dataforcanada.org](https://www.dataforcanada.org). The website is generated as a static website with Hugo and is served via a Cloudflare worker that reads a Cloudflare R2 bucket.
|
||||
|
||||
## How to Run Locally
|
||||
|
||||
```shell
|
||||
# Clone the repository
|
||||
git clone git@github.com:dataforcanada/www.dataforcanada.org.git
|
||||
|
||||
# Navigate to the project directory
|
||||
cd www.dataforcanada.org
|
||||
|
||||
# In Dev Container
|
||||
hugo server --logLevel debug --disableFastRender -p 1313
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
My website and code are distributed under an MIT license.
|
||||
|
||||
[Back to top](#top)
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Welcome to Data for Canada
|
||||
toc: false
|
||||
---
|
||||
|
||||
Datasets
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Blog"
|
||||
---
|
||||
|
||||
<div style="text-align: center; margin-top: 1em;">
|
||||
{{< hextra/hero-badge link="index.xml" >}}
|
||||
<span>RSS Feed</span>
|
||||
{{< icon name="rss" attributes="height=14" >}}
|
||||
{{< /hextra/hero-badge >}}
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Contact
|
||||
toc: false
|
||||
comments: false
|
||||
---
|
||||
|
||||
Feel free to get in touch with us at info@dataforcanada.org
|
||||
@@ -0,0 +1,5 @@
|
||||
module github.com/imfing/hextra-starter-template
|
||||
|
||||
go 1.21
|
||||
|
||||
require github.com/imfing/hextra v0.9.7 // indirect
|
||||
@@ -0,0 +1,2 @@
|
||||
github.com/imfing/hextra v0.9.7 h1:Zg5n24us36Bn/S/5mEUPkRW6uwE6vHHEqWSgN0bPXaM=
|
||||
github.com/imfing/hextra v0.9.7/go.mod h1:cEfel3lU/bSx7lTE/+uuR4GJaphyOyiwNR3PTqFTXpI=
|
||||
@@ -0,0 +1,71 @@
|
||||
# Hugo configuration file
|
||||
title: Data for Canada
|
||||
|
||||
# import hextra as module
|
||||
module:
|
||||
imports:
|
||||
- path: github.com/imfing/hextra
|
||||
|
||||
markup:
|
||||
# allow raw html
|
||||
goldmark:
|
||||
renderer:
|
||||
unsafe: true
|
||||
|
||||
# enable hextra syntax highlight
|
||||
highlight:
|
||||
noClasses: false
|
||||
|
||||
# Do not inject generator meta tag on homepage
|
||||
disableHugoGeneratorInject: true
|
||||
|
||||
# Parse Git commit
|
||||
enableGitInfo: true
|
||||
|
||||
enableInlineShortcodes: true
|
||||
enableEmoji: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
- name: Blog
|
||||
url: /blog/
|
||||
weight: 1
|
||||
- name: Contact
|
||||
url: /contact/
|
||||
weight: 2
|
||||
- name: Search
|
||||
weight: 3
|
||||
params:
|
||||
type: search
|
||||
- name: GitHub
|
||||
weight: 4
|
||||
url: "https://github.com/dataforcanada"
|
||||
params:
|
||||
icon: github
|
||||
|
||||
params:
|
||||
navbar:
|
||||
displayTitle: true
|
||||
displayLogo: true
|
||||
|
||||
page:
|
||||
# full (100%), wide (90rem), normal (1280px)
|
||||
width: wide
|
||||
|
||||
footer:
|
||||
displayCopyright: True
|
||||
displayPoweredBy: True
|
||||
|
||||
comments:
|
||||
enable: true
|
||||
type: giscus
|
||||
|
||||
giscus:
|
||||
repo: dataforcanada/www.dataforcanada.org
|
||||
repoId: R_kgDOPAaEeA
|
||||
category: General
|
||||
categoryId: DIC_kwDOPAaEeM4Cr4dH
|
||||
|
||||
editURL:
|
||||
enable: true
|
||||
base: "https://github.com/dataforcanada/www.dataforcanada.org/edit/main/content"
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "Data for Canada Website",
|
||||
"short_name": "Data for Canada",
|
||||
"start_url": "index.html",
|
||||
"icons": [
|
||||
{
|
||||
"src": "android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#000000",
|
||||
"display": "standalone"
|
||||
}
|
||||
Generated
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "worker",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"render2": "^1.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/render2": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/render2/-/render2-1.5.0.tgz",
|
||||
"integrity": "sha512-q60V+O193o4bevaWgMHoN9II5BsH4purEemu+NJnx0bBZ3x4Hxfkq9t0puOKemRnOhYhwc39HPVLaKgmAehFBQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"range-parser": "^1.2.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"render2": "^1.5.0"
|
||||
}
|
||||
}
|
||||
Generated
+30
@@ -0,0 +1,30 @@
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
render2:
|
||||
specifier: ^1.5.0
|
||||
version: 1.5.0
|
||||
|
||||
packages:
|
||||
|
||||
range-parser@1.2.1:
|
||||
resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
render2@1.5.0:
|
||||
resolution: {integrity: sha512-q60V+O193o4bevaWgMHoN9II5BsH4purEemu+NJnx0bBZ3x4Hxfkq9t0puOKemRnOhYhwc39HPVLaKgmAehFBQ==}
|
||||
|
||||
snapshots:
|
||||
|
||||
range-parser@1.2.1: {}
|
||||
|
||||
render2@1.5.0:
|
||||
dependencies:
|
||||
range-parser: 1.2.1
|
||||
@@ -0,0 +1,7 @@
|
||||
import render from 'render2'
|
||||
|
||||
export default {
|
||||
async fetch(request, env, ctx) {
|
||||
return render.fetch(request, env, ctx)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
name = "dataforcanada-website"
|
||||
main = "src/index.js"
|
||||
compatibility_date = "2022-05-15"
|
||||
# Set this to false if you don't want to use the default *.workers.dev route.
|
||||
# Note that *.workers.dev routes don't support native worker-level caching: https://developers.cloudflare.com/workers/runtime-apis/cache/
|
||||
workers_dev = true
|
||||
routes = [
|
||||
{ pattern = "www.dataforcanada.org", custom_domain = true }
|
||||
]
|
||||
|
||||
[vars]
|
||||
# The `access-control-allow-origin` header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
|
||||
# Optional, the `access-control-allow-origin` header is omitted if unset, which blocks all cross-origin requests.
|
||||
ALLOWED_ORIGINS = "https://www.dataforcanada.org"
|
||||
|
||||
# The `cache-control` header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control.
|
||||
# Optional, the `cache-control` header is omitted if unset, which would NOT disable caching: https://developers.cloudflare.com/workers/runtime-apis/cache/#headers
|
||||
# For example, you can disable all cache by setting this to `no-store`.
|
||||
CACHE_CONTROL = "max-age=86400, public"
|
||||
|
||||
# The string to prepend to each file path. Optional, nothing is prepended to the path if unset.
|
||||
PATH_PREFIX = ""
|
||||
|
||||
# Index file to search for on directory requests, set to "" to disable indexes
|
||||
# Relative to the directory of the request.
|
||||
#INDEX_FILE = ""
|
||||
INDEX_FILE = "index.html"
|
||||
|
||||
# File to fall back to when the requested path is not found in the bucket.
|
||||
# Incurs an additional read operation for 404 requests.
|
||||
# Set to "" to disable custom 404 fallbacks.
|
||||
# Relative to the root of the bucket.
|
||||
NOTFOUND_FILE = "404.html"
|
||||
|
||||
# Enable to show a directory listing fallback on paths ending in /
|
||||
# If INDEX_FILE is also provided, it will be used instead if the file exists.
|
||||
DIRECTORY_LISTING = true
|
||||
|
||||
# The number of items to show per page in directory listings.
|
||||
# Listings may also return less if the listing API call reaches a size limit.
|
||||
# Maximum of 1000.
|
||||
ITEMS_PER_PAGE = 1000
|
||||
|
||||
# Enable to hide files or directories beginning with . from directory listings.
|
||||
HIDE_HIDDEN_FILES = false
|
||||
|
||||
# Set a cache header here, e.g. "max-age=86400", if you want to cache directory listings.
|
||||
DIRECTORY_CACHE_CONTROL = "max-age=86400, public"
|
||||
|
||||
# Set debugging log enabled.
|
||||
LOGGING = false
|
||||
|
||||
# Set the number of retries allowed for each R2 operation (-1 for unlimited).
|
||||
R2_RETRIES = 0
|
||||
|
||||
[observability]
|
||||
enabled = false
|
||||
|
||||
[[r2_buckets]]
|
||||
binding = "R2_BUCKET"
|
||||
bucket_name = "dataforcanada-www" # Set this to your R2 bucket name. Required
|
||||
preview_bucket_name = "dataforcanada-www" # Set this to your preview R2 bucket name. Can be equal to bucket_name. Optional
|
||||
Reference in New Issue
Block a user