diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-10-22 14:02:47 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-10-22 14:05:28 -0700 |
commit | 979bd469d62ffb0ad53391a31aa789978ce1d6b8 (patch) | |
tree | 1f05d73690c5ec8fb1f6b0d361b4af9fe8379b51 /fatcat_scholar/templates | |
parent | aaa96e932fb365026a6c7646aabc98a95f48319e (diff) | |
download | fatcat-scholar-979bd469d62ffb0ad53391a31aa789978ce1d6b8.tar.gz fatcat-scholar-979bd469d62ffb0ad53391a31aa789978ce1d6b8.zip |
integrate goatcounter JS (analytics)
Diffstat (limited to 'fatcat_scholar/templates')
-rw-r--r-- | fatcat_scholar/templates/base.html | 4 | ||||
-rw-r--r-- | fatcat_scholar/templates/search.html | 5 | ||||
-rw-r--r-- | fatcat_scholar/templates/search_macros.html | 8 |
3 files changed, 14 insertions, 3 deletions
diff --git a/fatcat_scholar/templates/base.html b/fatcat_scholar/templates/base.html index 079b298..6302f6f 100644 --- a/fatcat_scholar/templates/base.html +++ b/fatcat_scholar/templates/base.html @@ -276,6 +276,10 @@ document.getElementById("search_form").onsubmit = function(){ document.getElementById("search_submit_button").classList.add("loading"); }; </script> +{% if settings.ENABLE_GOATCOUNTER -%} + {# for local testing: <script>window.goatcounter = {allow_local: true};</script> #} + <script data-goatcounter="{{ settings.GOATCOUNTER_ENDPOINT }}" async src="{{ settings.GOATCOUNTER_SCRIPT_URL }}"></script> +{%- endif %} {% block postscript %}{% endblock %} </body> </html> diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html index 35ecfa5..86355e2 100644 --- a/fatcat_scholar/templates/search.html +++ b/fatcat_scholar/templates/search.html @@ -9,6 +9,11 @@ {% endif %} {%- endmacro %} +{% block extra_head %} +{# among other things, this prevents query parameters from ending up in goatcounter #} +<link rel="canonical" href="{{ lang_prefix }}/search"> +{% endblock %} + {% block fullmain %} <!-- these hidden query fields should be *before* any form/button that could override them --> diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index 57a9011..879f96a 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -31,7 +31,7 @@ <h3 style="margin-bottom: 0.1em; font-size: 1.2em; font-weight: bold; line-height: 1.2em;"> {% if paper.doc_type == "work" %} - <a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}" style="color: #2224c7;" target="_blank" rel="noopener"> + <a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}" style="color: #2224c7;" target="_blank" rel="noopener" title="{{ _('access fatcat landing page') }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-title-fatcat-work"{% endif %}> {% if paper.biblio.title %} {{ paper.biblio.title[:512] }} {% if paper.biblio.title|length > 512 %}...{% endif %} @@ -61,7 +61,9 @@ {% endif %} {% elif paper.doc_type == "sim_page" %} - <a target="_blank" rel="noopener" href="https://archive.org/details/{{ paper.ia_sim.issue_item }}/page/{{ paper.ia_sim.first_page }}" style="color: #2224c7;">{% trans page_num = paper.ia_sim.first_page, journal_name = paper.biblio.container_name, volume = paper.biblio.volume, issue = paper.biblio.issue %}Page {{ page_num }} of {{ journal_name }} Vol. {{ volume }}, Issue {{ issue }}{% endtrans %}</a> + <a target="_blank" rel="noopener" href="https://archive.org/details/{{ paper.ia_sim.issue_item }}/page/{{ paper.ia_sim.first_page }}" style="color: #2224c7;" title="{{ _('access microfilm on archive.org') }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-title-sim-page"{% endif %}> + {% trans page_num = paper.ia_sim.first_page, journal_name = paper.biblio.container_name, volume = paper.biblio.volume, issue = paper.biblio.issue %}Page {{ page_num }} of {{ journal_name }} Vol. {{ volume }}, Issue {{ issue }}{% endtrans %} + </a> <span style="font-weight: normal; text-transform: uppercase; font-weight: bold;">[{{ _("page") }}]</span> {% endif %} @@ -268,7 +270,7 @@ {% set access_alt = _('fulltext access') %} {% endif %} - <a target="_blank" rel="noopener" href="{{ paper.fulltext.access_url}}" title="{{ access_alt }}"> + <a target="_blank" rel="noopener" href="{{ paper.fulltext.access_url}}" title="{{ access_alt }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-fulltext"{% endif %}> {% if paper.fulltext.thumbnail_url %} <div class="ui serp card"> <img src="{{ paper.fulltext.thumbnail_url }}" alt="fulltext thumbnail"> |