Throw out support for AMP, because AMP sucks anyway

This commit is contained in:
Danielle McLean 2018-06-12 12:27:35 +10:00
parent 59e40b551b
commit 5f9aca20c4
Signed by untrusted user: 00dani
GPG key ID: 8EB789DDF3ABD240
8 changed files with 0 additions and 192 deletions

View file

@ -23,10 +23,6 @@ class Entry:
def entry(self): def entry(self):
return self.plural + '_entry' return self.plural + '_entry'
@property
def entry_amp(self):
return self.entry + '_amp'
@property @property
def atom(self): def atom(self):
return reverse('entries:atom_by_kind', kwargs={'kind': self}) return reverse('entries:atom_by_kind', kwargs={'kind': self})

View file

@ -152,14 +152,6 @@ class Entry(ModelMeta, TimeStampedModel):
args.append(self.slug) args.append(self.slug)
return reverse('entries:entry', args=args) return reverse('entries:entry', args=args)
@property
def amp_url(self):
kind = kinds.from_id[self.kind]
args = [kind, self.id]
if kind.slug:
args.append(self.slug)
return reverse('entries:entry_amp', args=args)
@property @property
def short_url(self): def short_url(self):
return short_url(self) return short_url(self)

View file

@ -2,7 +2,6 @@
{% load absolute_url static %} {% load absolute_url static %}
{% block head %} {% block head %}
<link rel="amphtml" href="{{ entry.amp_url }}" />
<link rel="shortlink" href="{{ entry.short_url }}" /> <link rel="shortlink" href="{{ entry.short_url }}" />
<link rel="alternate" type="application/json+oembed" href="https://wirres.net/oembed/oembed.php?url={{ uri | absolute_url | urlencode }}" /> <link rel="alternate" type="application/json+oembed" href="https://wirres.net/oembed/oembed.php?url={{ uri | absolute_url | urlencode }}" />
{% endblock %} {% endblock %}

View file

@ -1,157 +0,0 @@
{% load absolute_url favicon friendly_url humanize jsonify lemoncurry_tags markdown theme_colour %}<!doctype html>
<html lang="en" class="h-entry">
<head>
<meta charset="utf-8" />
<title>{{ entry.title }} ~ {% site_name %}</title>
<link rel="canonical" href="{% absolute_url entry.url %}">
<link rel="shortlink" href="{% absolute_url entry.short_url %}" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script class="p-json-ld" type="application/ld+json">
{{ entry.json_ld | jsonify }}
</script>
{% get_favicons 'favicon/' %}
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<style amp-custom>
*, ::after, ::before {
box-sizing: border-box;
}
html {
background-color: {% theme_colour 0 %};
font-family: sans-serif;
line-height: 1.15;
}
body {
color: {% theme_colour 7 %};
display: flex;
flex-direction: column;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
margin: 0;
min-height: 100vh;
}
body > header {
background-color: {% theme_colour 1 %};
padding: .5rem 1rem;
}
body > header > a {
color: inherit;
display: inline-block;
font-size: 1.25rem;
font-weight: unset;
margin-right: 1rem;
margin: 0;
padding-bottom: .3125rem;
padding-top: .3125rem;
}
body > main {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
margin: 2rem 1rem;
}
body > main > article {
background-color: {% theme_colour 2 %};
border: 1px solid rgba(0,0,0,.125);
border-radius: .25rem;
padding: 1.25rem;
width: 90%;
}
body > main > article > h4 {
font-size: 1.5rem;
font-weight: 500;
margin: 0;
margin-bottom: .75rem;
}
body > main > article > aside {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
a {
text-decoration: none;
color: {% theme_colour 13 %};
}
a:hover {
color: {% theme_colour 12 %};
}
amp-img {
vertical-align: baseline;
}
</style>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
<header>
<a rel="home" href="{% url 'home:index' %}">{% site_name %}</a>
</header>
<main>
<article>
{% if entry.photo %}
<amp-img class="u-photo" src="{{ entry.photo.url }}" height="{{ entry.photo.height }}" width="{{ entry.photo.width }}" layout="responsive">
<span class="value" hidden>{% absolute_url entry.photo.url %}</span>
</amp-img>
{% endif %}
{% if entry.name %}
<h4 class="p-name">{{ entry.name }}</h4>
{% endif %}
<main class="e-content{% if not entry.name %} p-name{% endif %}">
{{ entry.content | markdown }}
</main>
<aside>
<a class="p-author h-card" href="{% absolute_url entry.author.url %}">
<amp-img class="u-photo" src="{{ entry.author.avatar.url }}" height="16" width="16" layout="fixed">
<span class="value" hidden>{% absolute_url entry.author.avatar.url %}</span>
</amp-img>
<span class="p-name">{{ entry.author.name }}</span>
</a>
<a class="u-uid u-url" href="{% absolute_url entry.url %}">
<time class="dt-published" datetime="{{ entry.published.isoformat }}">
📅
{{ entry.published | naturaltime }}
</time>
</a>
{% if entry.published != entry.updated %}
<time class="dt-updated" datetime="{{ entry.updated.isoformat }}">
✏️
{{ entry.updated | naturaltime }}
</time>
{% endif %}
<a class="u-url" href="{% absolute_url entry.amp_url %}">
⚡️
amp
</a>
<a class="u-url" href="{% absolute_url entry.short_url %}">
🔗
{{ entry.short_url | friendly_url }}
</a>
{% for c in entry.cats.all %}
<a class="p-category" href="{% absolute_url c.url %}">
🐾
<span class="value">{{ c.name }}</span>
</a>
{% endfor %}
{% for s in entry.syndications.all %}
<a class="u-syndication" href="{% absolute_url s.url %}">
🗞
{{ s.profile }}
</a>
{% endfor %}
</aside>
</article>
</main>
</body>
</html>

View file

@ -35,10 +35,6 @@
{{ entry.updated | naturaltime }} {{ entry.updated | naturaltime }}
</time> </time>
{% endif %} {% endif %}
<a class="u-url" href="{{ entry.amp_url }}">
<i class="fas fa-bolt"></i>
amp
</a>
<a class="u-url" href="{{ entry.short_url }}"> <a class="u-url" href="{{ entry.short_url }}">
<i class="fas fa-link"></i> <i class="fas fa-link"></i>
{{ entry.short_url | friendly_url }} {{ entry.short_url | friendly_url }}

View file

@ -32,10 +32,6 @@ urlpatterns = (
path('<kind:kind>/atom', feeds.AtomByKind(), name='atom_by_kind'), path('<kind:kind>/atom', feeds.AtomByKind(), name='atom_by_kind'),
path('<kind:kind>/rss', feeds.RssByKind(), name='rss_by_kind'), path('<kind:kind>/rss', feeds.RssByKind(), name='rss_by_kind'),
path('<kind:kind>/<int:id>/amp', perma.entry_amp, name='entry_amp'),
path('<kind:kind>/<int:id>/<slug:slug>/amp',
perma.entry_amp, name='entry_amp'),
path('<kind:kind>/<int:id>', perma.entry, name='entry'), path('<kind:kind>/<int:id>', perma.entry, name='entry'),
path('<kind:kind>/<int:id>/<slug:slug>', perma.entry, name='entry'), path('<kind:kind>/<int:id>/<slug:slug>', perma.entry, name='entry'),
) )

View file

@ -13,11 +13,3 @@ def entry(request, kind, id, slug=None):
'title': entry.title, 'title': entry.title,
'meta': entry.as_meta(request) 'meta': entry.as_meta(request)
} }
@render_to('entries/entry_amp.html')
def entry_amp(request, kind, id, slug=None):
entry = get_object_or_404(Entry, pk=id)
if request.path != entry.amp_url:
return redirect(entry.amp_url, permanent=True)
return {'entry': entry}

View file

@ -252,12 +252,6 @@ AGENT_COOKIE_SECURE = True
CORS_ORIGIN_ALLOW_ALL = True CORS_ORIGIN_ALLOW_ALL = True
CORS_URLS_REGEX = r'^/(?!admin|auth/(?:login|logout|indie)).*$' CORS_URLS_REGEX = r'^/(?!admin|auth/(?:login|logout|indie)).*$'
# django-debug-toolbar
# https://django-debug-toolbar.readthedocs.io/en/stable/configuration.html
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': 'lemoncurry.debug.show_toolbar',
}
# lemonshort # lemonshort
SHORT_BASE_URL = '/s/' SHORT_BASE_URL = '/s/'
SHORTEN_MODELS = { SHORTEN_MODELS = {