diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 248bb07..68ac4ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,5 @@ jobs: env: BEEMO_CONFIG: config.yml run: | - mkdir www python scripts/pyjokes_to_js.py - beemo \ No newline at end of file + beemo build \ No newline at end of file diff --git a/.gitignore b/.gitignore index e3da065..2111a14 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ www +apache2 +csv +analytics .DS_Store poetry.lock diff --git a/Makefile b/Makefile index 825b482..738b680 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,20 @@ +export BEEMO_CONFIG=config.yml + +.PHONY: build logs analytics serve serve-analytics + build: python scripts/pyjokes_to_js.py rm -rf www && mkdir -p www - BEEMO_CONFIG=config.yml beemo + BEEMO_CONFIG=$(BEEMO_CONFIG) beemo build + +logs: + BEEMO_CONFIG=$(BEEMO_CONFIG) beemo logs + +analytics: + BEEMO_CONFIG=$(BEEMO_CONFIG) beemo analytics serve: - python -m http.server -d www 8008 & \ No newline at end of file + python -m http.server -d www 8000 + +serve-analytics: + python -m http.server -d analytics 8000 diff --git a/README.md b/README.md index d6e4b3d..86c48e0 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,18 @@ built using a static site generator called [beemo](https://github.com/bennuttall This repo contains content, static files and [Chameleon](https://chameleon.readthedocs.io/en/latest/) templates for the pyjokes website. +## Build + +Requires [beemo](https://github.com/bennuttall/beemo) with the `logs` extra installed. + +```bash +make build # generate JS and build the site +make logs # process Apache logs into CSV +make analytics # generate analytics report +make serve # serve the site locally on port 8008 +make serve-analytics # serve the analytics report on port 8009 +``` + ## Licences The site content is copyright Pyjokes Society. diff --git a/config.yml b/config.yml index e909e90..e6f240a 100644 --- a/config.yml +++ b/config.yml @@ -1,4 +1,15 @@ -pages_dir: pages -static_dir: static templates_dir: templates -output_dir: www \ No newline at end of file +csv_dir: csv + +build: + pages_dir: pages + static_dir: static + output_dir: www + +logs: + logs_dir: apache2 + pattern: "pyjok.es-access*" + +analytics: + output_dir: analytics + base_url: https://pyjok.es diff --git a/templates/analytics.pt b/templates/analytics.pt new file mode 100644 index 0000000..7e59ff3 --- /dev/null +++ b/templates/analytics.pt @@ -0,0 +1,281 @@ + + +
+ + +| Page | Hits |
|---|---|
|
+ ${p['title']}
+ ↗
+ ${p['path']} + |
+ 0 | +
|
+ ${p['title']}
+ ↗
+ ${p['path']} + |
+ 0 | +
| + + | |
| Post | Hits |
|---|---|
|
+ ${p['title']}
+ ↗
+ ${p['path']} + |
+ 0 | +
|
+ ${p['title']}
+ ↗
+ ${p['path']} + |
+ 0 | +
| + + | |
| Page | Hits |
|---|---|
|
+ ${p['title']}
+ ↗
+ type
+ ${p['path']} + |
+ 0 | +
|
+ ${p['title']}
+ ↗
+ type
+ ${p['path']} + |
+ 0 | +
| + + | |
| Domain | Hits |
|---|---|
| ${item[0]} ↗ | +0 | +
| ${item[0]} ↗ | +0 | +
| + + | |