Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion openlibrary/plugins/openlibrary/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,6 @@ def is_bot():
'nsrbot',
'discordbot',
'ahrefsbot',
'`googlebot',
'coccocbot',
'buzzbot',
'laserlikebot',
Expand All @@ -1282,6 +1281,10 @@ def is_bot():
'yandex.com/bots',
'icc-crawler',
]

# As set in web_nginx.conf via the trap-link
if web.ctx.env.get("HTTP_X_SPS") == '1':
return True
if not web.ctx.env.get('HTTP_USER_AGENT'):
return True
user_agent = web.ctx.env['HTTP_USER_AGENT'].lower()
Expand Down
4 changes: 3 additions & 1 deletion openlibrary/templates/site/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
$if show_ol_shell:
$:render_template("lib/nav_foot", page)

<script src="/cdn/archive.org/athena.js" type="text/javascript"></script>
$if not is_bot():
<script src="/cdn/archive.org/athena.js" type="text/javascript"></script>

<script src="$static_url('build/js/all.js')" type="text/javascript"></script>
<div class="analytics-stats-time-calculator" data-time="$total_time"></div>
</body>
Expand Down
17 changes: 10 additions & 7 deletions openlibrary/templates/site/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
<meta name="robots" content="noindex">
<meta name="theme-color" content="#e2dcc5">


<link rel="canonical" href="$request.canonical_url" />
<link rel="preconnect" href="https://athena.archive.org">
<link rel="preconnect" href="https://apollo.archive.org">

$if not is_bot():
<link rel="preconnect" href="https://athena.archive.org">
<link rel="preconnect" href="https://apollo.archive.org">

<link rel="search" type="application/opensearchdescription+xml" title="Open Library" href="/static/opensearch.xml">
<link rel="manifest" href="/static/manifest.json">
Expand Down Expand Up @@ -59,12 +60,14 @@
</style>
</noscript>
<script>
$if not is_bot():
var _mtm = window._mtm = window._mtm || [];
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
(function() {
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src='https://apollo.archive.org/js/container_7cLc1b4U.js'; s.parentNode.insertBefore(g,s);
})();
})();

/* @licstart The following is the entire license notice for the
* JavaScript code in this page served from openlibrary.org.
*
Expand All @@ -84,16 +87,16 @@
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/

</script>

$if "dev" in ctx.features:
<link href="$static_url('build/css/page-dev.css')" rel="stylesheet" type="text/css"/>

<meta name="google-site-verification" content="KrqcZD4l5BLNVyjzSi2sjZBiwgmkJ1W7n6w7ThD7A74" />
<meta name="google-site-verification" content="vtXGm8q3UgP-f6qXTvQBo85uh3nmIYIotVqqdJDpyz4" />
<!-- Drini, Google Search Console -->
$# Drini's Google Search Console
<meta name="google-site-verification" content="XYOJ9Uj0MBr6wk7kj1IkttXrqY-bbRstFMADTfEt354" />
<!-- Drini, Bing Webmaster Tools -->
$# Drini's Bing Webmaster Tools
<meta name="msvalidate.01" content="8BEBECBEF537077737975A49D55B857D" />

$putctx("sent_head", True)
Loading