Skip to content

Commit 7231c5f

Browse files
authored
Fix GoatCounter (#1303)
1 parent 2b9b3a4 commit 7231c5f

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ instance/
6565

6666
# Sphinx documentation
6767
docs/_build/
68+
doc/_static/js/goatcounter.js
6869

6970
# PyBuilder
7071
target/

doc/conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import json
2222
import os
2323
import pathlib
24+
import shutil
2425

2526
from datetime import date
2627

@@ -29,6 +30,7 @@
2930
param.parameterized.docstring_signature = False
3031
param.parameterized.docstring_describe_params = False
3132

33+
import nbsite
3234
import panel
3335

3436
from nbsite import nbbuild
@@ -92,9 +94,18 @@ def setup(app):
9294
]
9395
}
9496

97+
# This conf.py overrides html_static_path inherited from nbsite so
98+
# we manually bring js/goatcounter.js
99+
gc_file = pathlib.Path(nbsite.__file__).parent / '_shared_static' / 'js' / 'goatcounter.js'
100+
if gc_file.exists():
101+
out_dir = pathlib.Path(__file__).parent / '_static' / 'js'
102+
out_dir.mkdir(exist_ok=True)
103+
shutil.copy(gc_file, out_dir / gc_file.name)
104+
95105
html_js_files = [
96106
(None, {'body': '{"shimMode": true}', 'type': 'esms-options'}),
97107
f'https://cdn.holoviz.org/panel/{js_version}/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js',
108+
'js/goatcounter.js',
98109
]
99110

100111
# Add any paths that contain templates here, relative to this directory.

0 commit comments

Comments
 (0)