Make the site discoverable as "RektBench" in search engines #14
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import django.http
|
||||
|
||||
# Public pages worth listing for search engines. The API, the client
|
||||
# endpoints, the account pages and the creation forms are left out on purpose.
|
||||
PUBLIC_PATHS = [
|
||||
'/',
|
||||
'/index/',
|
||||
'/greens/',
|
||||
'/users/',
|
||||
'/events/',
|
||||
'/machines/',
|
||||
'/networks/',
|
||||
]
|
||||
|
||||
# Prefixes that crawlers have no business visiting
|
||||
DISALLOWED_PREFIXES = [
|
||||
'/api/',
|
||||
'/client',
|
||||
'/scripts/',
|
||||
'/login/',
|
||||
'/register/',
|
||||
'/logout/',
|
||||
'/profile',
|
||||
'/newTest/',
|
||||
'/newTune/',
|
||||
'/newDatagen/',
|
||||
'/newNetwork/',
|
||||
]
|
||||
|
||||
def robots_txt(request):
|
||||
|
||||
lines = ['User-agent: *']
|
||||
lines += ['Disallow: {}'.format(prefix) for prefix in DISALLOWED_PREFIXES]
|
||||
lines += ['', 'Sitemap: {}'.format(request.build_absolute_uri('/sitemap.xml'))]
|
||||
|
||||
return django.http.HttpResponse('\n'.join(lines) + '\n', content_type='text/plain')
|
||||
|
||||
def sitemap_xml(request):
|
||||
|
||||
entries = ''.join(
|
||||
'<url><loc>{}</loc></url>'.format(request.build_absolute_uri(path))
|
||||
for path in PUBLIC_PATHS
|
||||
)
|
||||
|
||||
body = (
|
||||
'<?xml version="1.0" encoding="UTF-8"?>\n'
|
||||
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{}</urlset>\n'
|
||||
).format(entries)
|
||||
|
||||
return django.http.HttpResponse(body, content_type='application/xml')
|
||||
+5
-1
@@ -18,10 +18,14 @@
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
import django.urls, OpenBench.views
|
||||
import django.urls, OpenBench.views, OpenBench.seo
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
# Files for search engines
|
||||
django.urls.path(r'robots.txt', OpenBench.seo.robots_txt),
|
||||
django.urls.path(r'sitemap.xml', OpenBench.seo.sitemap_xml),
|
||||
|
||||
# Links for account management
|
||||
django.urls.path(r'register/', OpenBench.views.register),
|
||||
django.urls.path(r'login/', OpenBench.views.login),
|
||||
|
||||
@@ -27,7 +27,21 @@
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
||||
|
||||
<title>RektBench</title>
|
||||
<title>{% block title %}RektBench - Distributed SPRT Testing for Chess Engines{% endblock %}</title>
|
||||
<meta name="description" content="{% block description %}RektBench is a distributed SPRT testing framework for chess engines: live tests, results, networks and worker machines.{% endblock %}">
|
||||
<meta name="robots" content="{% block robots %}index, follow{% endblock %}">
|
||||
<link rel="canonical" href="{{ request.scheme }}://{{ request.get_host }}{{ request.path }}">
|
||||
|
||||
<meta property="og:site_name" content="RektBench">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="RektBench">
|
||||
<meta property="og:description" content="Distributed SPRT testing framework for chess engines.">
|
||||
<meta property="og:url" content="{{ request.scheme }}://{{ request.get_host }}{{ request.path }}">
|
||||
<meta name="twitter:card" content="summary">
|
||||
|
||||
<script type="application/ld+json">
|
||||
{"@context": "https://schema.org", "@type": "WebSite", "name": "RektBench", "alternateName": "Rekt Bench", "url": "{{ request.scheme }}://{{ request.get_host }}/"}
|
||||
</script>
|
||||
|
||||
{% block scripts %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in new issue
Block a user