add plausibleAnalytics support for koch docs[backport:1.6] (#20454)
add plausibleAnalytics to koch docs[backport:1.6]
This commit is contained in:
parent
ae050b05e9
commit
96c5586d03
3 changed files with 10 additions and 4 deletions
|
|
@ -304,6 +304,10 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
|
|||
conf.configVars, filename.string,
|
||||
docgenFindFile, compilerMsgHandler)
|
||||
|
||||
if conf.configVars.hasKey("doc.googleAnalytics") and
|
||||
conf.configVars.hasKey("doc.plausibleAnalytics"):
|
||||
doAssert false, "Either use googleAnalytics or plausibleAnalytics"
|
||||
|
||||
if conf.configVars.hasKey("doc.googleAnalytics"):
|
||||
result.analytics = """
|
||||
<script>
|
||||
|
|
@ -317,6 +321,10 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
|
|||
|
||||
</script>
|
||||
""" % [conf.configVars.getOrDefault"doc.googleAnalytics"]
|
||||
elif conf.configVars.hasKey("doc.plausibleAnalytics"):
|
||||
result.analytics = """
|
||||
<script defer data-domain="$1" src="https://plausible.io/js/plausible.js"></script>
|
||||
""" % [conf.configVars.getOrDefault"doc.plausibleAnalytics"]
|
||||
else:
|
||||
result.analytics = ""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue