forked from web/portal
replace hugo by a self provided python script
This commit is contained in:
25
README.md
25
README.md
@@ -1,34 +1,31 @@
|
||||
# Ecogood Portal Page
|
||||
|
||||
This <abbr title="Single Page Application">SPA</abbr> shows a list of available web applications of ecogood.
|
||||
This <abbr title="Single Page Application">SPA</abbr> shows a list of the available ECG web applications.
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
|
||||
- generated static website powered by [Hugo](https://gohugo.io/)
|
||||
- generated static website powered a small python script
|
||||
- easily extensible by a YAML definition
|
||||
- responsive layout
|
||||
- Respects Privacy and Security by setting CSP and RP
|
||||
- Apache based basic Authentication included
|
||||
- Respects Privacy and Security by being ready for CSP and RP
|
||||
|
||||
## Development
|
||||
## Build
|
||||
|
||||
A live server can be started as usual with hugo:
|
||||
|
||||
hugo server
|
||||
python3 build.py items.yml
|
||||
|
||||
## Deployment
|
||||
|
||||
The build and deploy workflow is provided by the contained shell script `build+deploy.sh`.
|
||||
|
||||
**Tasks:**
|
||||
```bash
|
||||
chmod +x build+deploy.sh
|
||||
./build+deploy.sh
|
||||
```
|
||||
|
||||
**Executed tasks:**
|
||||
|
||||
- clean the output folder
|
||||
- build the project
|
||||
- upload to the remote SSH target
|
||||
|
||||
```bash
|
||||
chmod +x build+deploy.sh
|
||||
./build+deploy.sh
|
||||
```
|
||||
@@ -4,8 +4,13 @@ set -o nounset ## set -u : exit the script if you try to use an uninitialised
|
||||
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
|
||||
#set -o xtrace ## set -x : Print command traces before executing command
|
||||
|
||||
# clean up
|
||||
rm -rf public
|
||||
hugo
|
||||
|
||||
# build
|
||||
python3 build.py items.yml
|
||||
|
||||
# deploy
|
||||
rsync -v --archive --delete public/ \
|
||||
ecg00-portal@ecg00.hostsharing.net:doms/my.ecogood.org/htdocs-ssl/
|
||||
|
||||
|
||||
46
build.py
Executable file
46
build.py
Executable file
@@ -0,0 +1,46 @@
|
||||
import codecs
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from distutils import dir_util
|
||||
from string import Template
|
||||
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
__location__ = os.path.realpath(os.path.dirname(__file__))
|
||||
static_folder = os.path.join(__location__, 'static')
|
||||
content_folder = os.path.join(__location__, 'content')
|
||||
output_folder = os.path.join(__location__, 'public')
|
||||
|
||||
config_file = sys.argv[1]
|
||||
|
||||
yaml = YAML(typ='safe')
|
||||
|
||||
with codecs.open(config_file, 'r', encoding='utf-8') as stream:
|
||||
try:
|
||||
config = yaml.load(stream)
|
||||
except yaml.YAMLError as exc:
|
||||
print(exc)
|
||||
exit(1)
|
||||
|
||||
template_item_text = codecs.open(os.path.join(content_folder, 'item.tmpl.html'), 'r',
|
||||
encoding='utf-8').read()
|
||||
template_item = Template(template_item_text)
|
||||
|
||||
items = ''
|
||||
|
||||
for config_item in config['items']:
|
||||
items += template_item.substitute(config_item)
|
||||
|
||||
template_page_text = codecs.open(os.path.join(content_folder, 'index.tmpl.html'), 'r', encoding='utf-8').read()
|
||||
template_page = Template(template_page_text)
|
||||
outcome = template_page.substitute(items=items)
|
||||
|
||||
os.makedirs(output_folder, exist_ok=True)
|
||||
|
||||
outfile_index = os.path.join(output_folder, 'index.html')
|
||||
|
||||
from distutils.dir_util import copy_tree
|
||||
copy_tree(static_folder, output_folder)
|
||||
|
||||
html = codecs.open(outfile_index, 'w', encoding='utf-8').write(outcome)
|
||||
@@ -1,5 +0,0 @@
|
||||
baseURL = "/"
|
||||
languageCode = "en"
|
||||
title = "ECG Portal"
|
||||
|
||||
disableKinds = ["RSS", "sitemap", "taxonomy", "taxonomyTerm"]
|
||||
18
content/index.tmpl.html
Normal file
18
content/index.tmpl.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>ECG portal</title>
|
||||
<link rel="stylesheet" href="ecogood.css"/>
|
||||
<link rel="icon" href="favicon-cropped.webp" sizes="32x32" />
|
||||
<link rel="icon" href="favicon.webp" sizes="192x192" />
|
||||
<link rel="apple-touch-icon-precomposed" href="favicon.png" />
|
||||
<meta name="msapplication-TileImage" content="favicon.webp" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<img class="heading-img" src="ecg-portal-logo.png" />
|
||||
<div class="epframe">
|
||||
$items
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
5
content/item.tmpl.html
Normal file
5
content/item.tmpl.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<a href="$url" target="_blank">
|
||||
<div class="epsquare epcol$cssClass">
|
||||
<div class="eptextfunc">$title</div>
|
||||
<div class="eptexttool">$solution</div>
|
||||
</div></a>
|
||||
@@ -1,4 +1,3 @@
|
||||
---
|
||||
items:
|
||||
# - url: https://forum.ecogood.org
|
||||
# solution: Discourse
|
||||
@@ -26,7 +25,7 @@ items:
|
||||
solution: SmartWE
|
||||
title: Membership admin
|
||||
cssClass: smartwe
|
||||
- url: https://git.ecogood.world
|
||||
- url: https://git.ecogood.org
|
||||
solution: Gitea
|
||||
title: Code hosting
|
||||
cssClass: code
|
||||
@@ -34,5 +33,3 @@ items:
|
||||
solution: JIRA
|
||||
title: Ticket system
|
||||
cssClass: projekte
|
||||
|
||||
---
|
||||
@@ -1,15 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="{{.Site.Language.Lang }}">
|
||||
<head>
|
||||
<title>ECG portal</title>
|
||||
<link rel="stylesheet" href="{{ "ecogood.css" | absURL }}"/>
|
||||
<link rel="icon" href="{{ "favicon-cropped.webp" | absURL }}" sizes="32x32" />
|
||||
<link rel="icon" href="{{ "favicon.webp" | absURL }}" sizes="192x192" />
|
||||
<link rel="apple-touch-icon-precomposed" href="{{ "favicon.png" | absURL }}" />
|
||||
<meta name="msapplication-TileImage" content="{{ "favicon.webp" | absURL }}" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
{{ block "main" . }}{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,17 +0,0 @@
|
||||
{{ define "main" }}
|
||||
<img class="heading-img" src="{{ "ecg-portal-logo.png" | absURL }}" />
|
||||
|
||||
<div>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
<div class="epframe">
|
||||
{{ range .Params.items }}
|
||||
<a href="{{ .url }}" target="_blank">
|
||||
<div class="epsquare epcol{{ .cssClass }}">
|
||||
<div class="eptextfunc">{{ .title }}</div>
|
||||
<div class="eptexttool">{{ .solution }}</div>
|
||||
</div></a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user