mirror of
https://github.com/Findus23/acronomy.git
synced 2024-09-19 15:33:45 +02:00
lots of HTML and meta tag improvements
This commit is contained in:
parent
aa501611ed
commit
57b22990a5
5 changed files with 39 additions and 11 deletions
|
@ -42,10 +42,9 @@ class WikipediaLink(models.Model):
|
|||
self.thumbnail = thumbnail
|
||||
self.fetched = True
|
||||
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return f"https://en.wikipedia.org/wiki/{self.title}"
|
||||
return f"https://en.wikipedia.org/wiki/{self.title.replace(' ', '_')}"
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
|
|
@ -6,6 +6,27 @@
|
|||
<!-- Only embed katex if there is an equation on the page -->
|
||||
<link rel="stylesheet" href="{% static "libs/katex.min.css" %}">
|
||||
{% endif %}
|
||||
<meta property="og:title" content="{{ acro.name }}: {{ acro.full_name }} ‐ Acronomy"/>
|
||||
<meta property="og:type" content="website"/>
|
||||
<meta property="og:url" content="https://acronomy.lw1.at{{ acro.get_absolute_url }}"/>
|
||||
<meta property="og:locale" content="en_GB"/>
|
||||
{% if acro.wiki_articles.all and acro.wiki_articles.all.0.description %}
|
||||
<!-- This short description is from the Wikipedia project and licensed under Creative Commons Attribution-ShareAlike 3.0 -->
|
||||
<meta name="description" content="{{ acro.name }}: {{ acro.full_name }} ({{ acro.wiki_articles.all.0.description }})">
|
||||
<meta property="og:description" content="{{ acro.wiki_articles.all.0.description }}"/>
|
||||
|
||||
{% endif %}
|
||||
{% if acro.wiki_articles.all and acro.wiki_articles.all.0.thumbnail %}
|
||||
{# Hardcoded URLs are ugly, but there is no other simple solution #}
|
||||
<meta property="og:image" content="https://acronomy.lw1.at{{ acro.wiki_articles.all.0.thumbnail.thumbnail.url }}"/>
|
||||
<meta property="og:image:width" content="{{ acro.wiki_articles.all.0.thumbnail.thumb_width }}" />
|
||||
<meta property="og:image:height" content="{{ acro.wiki_articles.all.0.thumbnail.thumb_height }}" />
|
||||
{% else %}
|
||||
<meta property="og:image" content="https://acronomy.lw1.at{% static "images/logo.png" %}"/>
|
||||
<meta property="og:image:width" content="1024" />
|
||||
<meta property="og:image:height" content="1024" />
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}{{ acro.name }}: {{ acro.full_name }} ‐ Acronomy{% endblock %}
|
||||
|
@ -13,7 +34,8 @@
|
|||
{% block heading %}
|
||||
<h1 class="acronym">{{ acro.name }}</h1>
|
||||
<p class="fullName">
|
||||
{% for letter in acro.full_name %}<span {% if forloop.counter0 in acro.acro_letters %}class="al"{% endif %}>{{ letter }}</span>{% endfor %}
|
||||
{% for letter in acro.full_name %}
|
||||
<span {% if forloop.counter0 in acro.acro_letters %}class="al"{% endif %}>{{ letter }}</span>{% endfor %}
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -55,7 +77,7 @@
|
|||
{% if link.thumbnail %}
|
||||
<a href="{{ link.url }}">
|
||||
<img src="{{ link.thumbnail.thumbnail.url }}" class="card-img-top"
|
||||
width="{{ link.thumbnail.thumbnail_width }}" height="{{ link.thumbnail.thumbnail_height }}">
|
||||
width="{{ link.thumbnail.thumb_width }}" height="{{ link.thumbnail.thumb_height }}">
|
||||
</a>
|
||||
{% endif %}
|
||||
<div class="card-body">
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Acronomy - Astronomical Acronyms Explained{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
<meta name="description" content="Common astronomical acronyms explained — because astronomers love acronyms">
|
||||
{% endblock %}
|
||||
|
||||
{% block heading %}
|
||||
<h1 class="acronym">Acronomy</h1>
|
||||
<p class="fullName">because Astronomers love Acronyms</p>
|
||||
<p class="fullName">because astronomers love acronyms</p>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row cardrow">
|
|
@ -18,7 +18,7 @@ handler404 = 'acros.views.PageNotFoundView'
|
|||
|
||||
|
||||
class IndexView(generic.TemplateView):
|
||||
template_name = "acros/index.html"
|
||||
template_name = "acros/homepage.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
data = super().get_context_data(**kwargs)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{% load static %}
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Acronomy{% endblock %}</title>
|
||||
<link rel="icon" href="{% static "images/logo.png" %}" sizes="1024x1024">
|
||||
<link rel="icon" href="{% static "images/logo.svg" %}" sizes="any" type="image/svg+xml">
|
||||
|
@ -16,7 +16,7 @@
|
|||
{% block extra_head %}
|
||||
{% endblock %}
|
||||
{% if not debug %}
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _paq = window._paq = window._paq || [];
|
||||
_paq.push(['disableCookies']);
|
||||
_paq.push(['setRequestMethod', 'POST']);
|
||||
|
@ -48,17 +48,16 @@
|
|||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<div class="navbar-nav">
|
||||
<a class="nav-item nav-link" href="{% url 'add' %}">Add</a>
|
||||
{% block admin_navbar %}
|
||||
{% endblock %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
{# <div class="container {{ referrers is defined ? "edit" }}">#}
|
||||
<div class="container {% block containerclasses %}{% endblock %}">
|
||||
{% bootstrap_messages %}
|
||||
{% block heading %}
|
||||
|
|
Loading…
Reference in a new issue