File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 2828 </p>
2929
3030sphinx :
31+ local_extensions :
32+ _plausible : .
3133 config :
3234 html_show_copyright : false
Original file line number Diff line number Diff line change 1+ """Sphinx extension to add Plausible analytics to Jupyter Book."""
2+
3+
4+ def setup (app ):
5+ """Add Plausible analytics scripts to the site."""
6+ # Add the external Plausible script for jupyter.org
7+ app .add_js_file (
8+ "https://plausible.io/js/pa-B75UO5--FNXYQSG7GBWkf.js" ,
9+ loading_method = "async"
10+ )
11+
12+ # Add the inline initialization script
13+ plausible_init = """
14+ window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
15+ plausible.init({hashBasedRouting:true})
16+ """
17+ app .add_js_file (None , body = plausible_init )
18+
19+ return {
20+ 'version' : '0.1' ,
21+ 'parallel_read_safe' : True ,
22+ 'parallel_write_safe' : True ,
23+ }
You can’t perform that action at this time.
0 commit comments