Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ src/resources
src/public
src/.hugo_build.lock
src/i18n/*
!src/i18n/.gitkeep
node_modules/
.DS_Store
*.log
Expand Down
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ENV HUGO_VERSION="0.152.2"

LABEL description="gohugo build"
LABEL version="1.0"
LABEL maintainer="peter@froggle.org"

WORKDIR /tmp

Expand All @@ -23,15 +22,11 @@ COPY ./ /root/
RUN bin/build-hugo.sh

# Serve image (stable nginx version)
# This cannot use Alpine because test/Dockerfile builds on this image and
# expects it to have apt-get.
FROM nginx:1.28

LABEL description="dcrweb server"
LABEL description="decred web server"
LABEL version="1.0"
LABEL maintainer="peter@froggle.org"

COPY conf/nginx.conf /etc/nginx/conf.d/default.conf

# /usr/share/nginx/html is also hardcoded in test/run-test.sh
COPY --from=0 /root/src/public/ /usr/share/nginx/html
70 changes: 27 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,53 @@
# dcrweb
[![Build Status](https://github.com/decred/dcrweb/actions/workflows/build.yml/badge.svg)](https://github.com/decred/dcrweb/actions/workflows/build.yml)
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
# decred-staging — decred site

## Overview
This is one of three independent Hugo projects under `decred-staging/`. It is
the source for the staging build of the Decred main site (home, wallets,
exchanges, governance).

This is the code for the [decred.org](https://decred.org) website.
It is built using the static site generator [Hugo](https://gohugo.io/) and
utilizes [Docker](https://www.docker.com/) for testing and deployment.
It is built with [Hugo](https://gohugo.io/) (extended, v0.152.2) and uses
[Docker](https://www.docker.com/) for deployment, mirroring the `dcrweb-master`
template.

## Development

To start a development web server at <http://localhost:1313>:
Start a local development web server at <http://localhost:1313>:

```sh
./bin/watch.sh
```

Run the HTML validator to ensure all of the generated files are syntactically
correct:
The `watch.sh` script will:

```sh
./bin/test.sh
```
1. Convert `transifex_catalogs/*.json` → `src/i18n/*.json`.
2. Clone `src/content/en` into `src/content/<lang>` for each non-English
language declared in `src/config.yml`.
3. Run `hugo server` against `src/`.

## Deployment with Docker

```sh
# Build the decred/dcrweb image.
# Build the image.
./bin/build.sh

# Start the container.
docker run -d -p <local port>:80 decred/dcrweb:latest
docker run -d -p <local port>:80 decred/decred-web:latest
```

## Editing content

The most frequently updated content sections live in the below locations:

| Section | File |
| ------------------ | ---- |
| Media Coverage | `src/data/news/coverage.yml` |
| Decred Journals | `src/data/news/decred_journals.yml` |
| Software releases | `src/data/news/software_releases.yml` |
| Press releases | `src/content/news/*.md` |
| Wallets | `src/data/wallets/wallets.yml` |
| Community channels | `src/data/community/channels.yml` |
| Support channels | `src/data/community/support.yml` |
| Publications | `src/data/community/publications.yml` |
| Exchanges | `src/data/exchanges/*.yml` |

The other sections live under `src/layouts`.
These pages are implemented as [Hugo templates](https://gohugo.io/templates/)
and are
[localized](https://gohugo.io/content-management/multilingual/#translation-of-strings).
The message catalogs can be found in `src/i18n`.
When making changes in the templates, you'll want to keep the strings in the
catalogs, please follow the naming scheme in the existing templates.
Translation strings are defined in `transifex_catalogs/<lang>.json`
(flat `key: value` pairs). The English file is the source of truth; other
languages should mirror its keys.

## Localization
Page templates live in `src/layouts/`. Common chrome (head, header, footer,
language switcher) is in `src/layouts/_default/baseof.html` and
`src/layouts/partials/`.

Internationalization (i18n) files for translating dcrweb into languages other
than English are in the [transifex_catalogs](./transifex_catalogs/)
directory.
A README in that directory explains how translation strings should be updated.
## Localization

## License
Supported languages are configured in `src/config.yml` under the `languages`
key. To add a new language:

dcrweb is licensed under the liberal ISC License.
1. Add an entry to `src/config.yml`.
2. Drop a `<lang>.json` translation file into `transifex_catalogs/`.
3. Re-run `./bin/watch.sh`.
10 changes: 5 additions & 5 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
set -e

echo ""
echo "================================="
echo " Building dcrweb docker image "
echo "================================="
echo "==================================="
echo " Building decred docker image "
echo "==================================="
echo ""


IMAGE_NAME=decred/dcrweb
IMAGE_NAME=decred/decred-web

if [ "$1" != "" ]; then
IMAGE_NAME=$1
Expand All @@ -23,6 +23,6 @@ echo "==================="
echo " Build complete"
echo "==================="
echo ""
echo "You can now run dcrweb with the following command:"
echo "You can now run the site with the following command:"
echo " docker run -d --rm -p <local port>:80 $IMAGE_NAME:latest"
echo ""
18 changes: 0 additions & 18 deletions bin/encode-video.sh

This file was deleted.

1 change: 0 additions & 1 deletion bin/i18n-convert-transifex-hugo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ for i in transifex_catalogs/*.json; do
rm -rf src/content/$lang
cp -r src/content/en src/content/$lang
done

43 changes: 0 additions & 43 deletions bin/test.sh

This file was deleted.

127 changes: 2 additions & 125 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,115 +13,24 @@ server {
server_name localhost;

charset utf-8;

# Hide Version
server_tokens off;

# Security Headers
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "no-referrer" always;

location /base58 {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/base58 git https://github.com/decred/base58">';
}
return 301 https://pkg.go.dev/decred.org/base58;
}
location /cspp {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/cspp git https://github.com/decred/cspp">';
}
return 301 https://pkg.go.dev/decred.org/cspp;
}
location /dcrctl {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/dcrctl git https://github.com/decred/dcrctl">';
}
return 301 https://pkg.go.dev/decred.org/dcrctl;
}
location /dcrd {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/dcrd git https://github.com/decred/dcrd">';
}
return 301 https://pkg.go.dev/decred.org/dcrd;
}
location /dcrdata {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/dcrdata git https://github.com/decred/dcrdata">';
}
return 301 https://pkg.go.dev/decred.org/dcrdata;
}
location /dcrdex {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/dcrdex git https://github.com/decred/dcrdex">';
}
return 301 https://pkg.go.dev/decred.org/dcrdex;
}
location /dcrdex-assets {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/dcrdex-assets git https://github.com/decred/dcrdex-assets">';
}
return 301 https://pkg.go.dev/decred.org/dcrdex-assets;
}
location /dcrwallet {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/dcrwallet git https://github.com/decred/dcrwallet">';
}
return 301 https://pkg.go.dev/decred.org/dcrwallet;
}
location /go-socks {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/go-socks git https://github.com/decred/go-socks">';
}
return 301 https://pkg.go.dev/decred.org/go-socks;
}
location /slog {
if ($arg_go-get = "1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="decred.org/slog git https://github.com/decred/slog">';
}
return 301 https://pkg.go.dev/decred.org/slog;
}

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

location /media/ {
alias /usr/share/nginx/html/media/;
autoindex on;
}

location /videos/ {
alias /usr/share/nginx/html/videos/;
gzip off;
gzip_static off;
mp4;
mp4_max_buffer_size 75m; # keep all videos in memory (46M + some buffer)
}

location /.well-known/matrix {
alias /usr/share/nginx/html/.well-known/matrix;
default_type application/json;
add_header Access-Control-Allow-Origin '*';
}

error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
Expand All @@ -138,36 +47,4 @@ server {
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/rss+xml image/svg+xml text/javascript;

# Redirection for dcrweb pages which no longer exist.
rewrite ^/roadmap/?$ $scheme://$http_host/ permanent;
rewrite ^/sustainable/?$ $scheme://$http_host/ permanent;
rewrite ^/adaptable/?$ $scheme://$http_host/ permanent;
rewrite ^/security/?$ $scheme://$http_host/ permanent;
rewrite ^/stakepools/?$ $scheme://$http_host/vsp/ permanent;
rewrite ^/downloads/?$ $scheme://$http_host/wallets/ permanent;
rewrite ^/support/?$ $scheme://$http_host/community/ permanent;
rewrite ^/press/?$ $scheme://$http_host/news/ permanent;
rewrite ^/contributors/?$ https://github.com/orgs/decred/people permanent;
rewrite ^/matrix/?$ https://chat.decred.org/ permanent;
rewrite ^/matrix-support/?$ https://chat.decred.org/#/room/#support:decred.org permanent;
rewrite ^/recruiting/?$ https://docs.decred.org/contributing/overview/ permanent;
rewrite ^/history/?$ https://docs.decred.org/getting-started/project-history/ permanent;
rewrite ^/brief/?$ https://docs.decred.org/getting-started/business-brief/ permanent;

# Redirections for translated pages. Should match the list above.
rewrite ^/(.*)/roadmap/?$ $scheme://$http_host/$1/ permanent;
rewrite ^/(.*)/sustainable/?$ $scheme://$http_host/$1/ permanent;
rewrite ^/(.*)/adaptable/?$ $scheme://$http_host/$1/ permanent;
rewrite ^/(.*)/security/?$ $scheme://$http_host/$1/ permanent;
rewrite ^/(.*)/stakepools/?$ $scheme://$http_host/$1/vsp/ permanent;
rewrite ^/(.*)/downloads/?$ $scheme://$http_host/$1/wallets/ permanent;
rewrite ^/(.*)/support/?$ $scheme://$http_host/$1/community/ permanent;
rewrite ^/(.*)/press/?$ $scheme://$http_host/$1/news/ permanent;
rewrite ^/(.*)/contributors/?$ https://github.com/orgs/decred/people permanent;
rewrite ^/(.*)/matrix/?$ https://chat.decred.org/ permanent;
rewrite ^/(.*)/matrix-support/?$ https://chat.decred.org/#/room/#support:decred.org permanent;
rewrite ^/(.*)/recruiting/?$ https://docs.decred.org/contributing/overview/ permanent;
rewrite ^/(.*)/history/?$ https://docs.decred.org/getting-started/project-history/ permanent;
rewrite ^/(.*)/brief/?$ https://docs.decred.org/getting-started/business-brief/ permanent;
}
1 change: 0 additions & 1 deletion src/archetypes/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

7 changes: 0 additions & 7 deletions src/assets/js/bootstrap.bundle-5.0.2.min.js

This file was deleted.

Loading