A boilerplate static site generator using all of my favorite things.
This boilerplate is good for content editors in how the file structure is organized.
It will pull from a separate git repository for the content.
react and redux stack is added, for particular pages that need more dynamic or reactive things.
react can show up at particulat paths.
templates are in layouts
, and the template is chosen for the content. see sample_content
To Deploy this site, One must run:
npm install
This installs the necessary libraries.
for git content repositories only:
npm run initial-git-content
npm run build
This updates the content repository and builds the site to dist
.
After the deploy steps worked well, running an npm run dev
should set up the development server at http://localhost:8080
.
dist
generated by npm run build
should then be served with nginx. the following config works well:
server {
listen 80;
server_name yoursite.org;
client_max_body_size 20M;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
client_max_body_size 20M;
server_name yoursite.org ;
# SSL STUFF
rewrite ^(/.*)\.html(\?.*)?$ $1$2 ;
rewrite ^/(.*)/$ /$1 ;
root /PATH-TO-APPLICAION/dist;
access_log /var/log/nginx/site-prd/access.log;
error_log /var/log/nginx/site-prd/error.log;
default_type "text/html";
index index.html;
try_files $uri/index.html $uri.html $uri/ $uri =404;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Block access to "hidden" files and directories whose names begin with a
# period.
location ~ (^|/)\. {
return 403;
}
location ~* \.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|pdf|ppt|txt|tar|wav|bmp|rtf|js|mp3|avi|mov|flv|swf|woff|ttf|html)$ {
access_log off;
expires max;
}
error_page 500 502 503 504 /50x.html;
error_page 404 /404.html;
}