diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7876343..684c8b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,6 +27,4 @@ jobs: - name: Build the site env: BEEMO_CONFIG: config.yml - run: | - mkdir www - beemo \ No newline at end of file + run: beemo build \ No newline at end of file diff --git a/.gitignore b/.gitignore index 950b99e..11af2fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .DS_Store www +apache2 +csv +analytics diff --git a/Makefile b/Makefile index b7a14e2..637b899 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,18 @@ +export BEEMO_CONFIG=config.yml + +.PHONY: build logs analytics serve serve-analytics + build: - 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 8011 & + 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 e7a17f6..311d1c9 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,18 @@ static site generator called [beemo](https://github.com/bennuttall/beemo). This repo contains content, static files and [Chameleon](https://chameleon.readthedocs.io/en/latest/) templates for the website. +## Build + +Requires [beemo](https://github.com/bennuttall/beemo) with the `logs` extra installed. + +```bash +make build # build the site +make logs # process Apache logs into CSV +make analytics # generate analytics report +make serve # serve the site locally on port 8011 +make serve-analytics # serve the analytics report on port 8012 +``` + ## Licences Contents are Copyright Python North West. The HTML template is provide by [HTML5 diff --git a/config.yml b/config.yml index e909e90..fb43412 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: "pynw.org-access*" + +analytics: + output_dir: analytics + base_url: https://pynw.org 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 | +
| + + | |