SEO Optimization #119

This commit is contained in:
Daniel Grams 2021-02-16 07:56:22 +01:00
parent 37ddb2058d
commit c00403fc5e
12 changed files with 47 additions and 21 deletions

View File

@ -19,6 +19,7 @@ app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ["DATABASE_URL"]
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config["SECURITY_CONFIRMABLE"] = True
app.config["SECURITY_POST_LOGIN_VIEW"] = "manage"
app.config["SECURITY_TRACKABLE"] = True
app.config["SECURITY_REGISTERABLE"] = True
app.config["SECURITY_SEND_REGISTER_EMAIL"] = True

BIN
project/static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,4 @@
User-agent: *
Disallow: /manage
Disallow: /api
Disallow: */widget/*

View File

@ -4,11 +4,6 @@
{% block title %}
{{ event.name }}
{% endblock %}
{% block header %}
<script type="application/ld+json">
{{ structured_data | safe }}
</script>
{% endblock %}
{% block content %}
<nav aria-label="breadcrumb">

View File

@ -104,21 +104,21 @@ oveda - Offene Veranstaltungsdatenbank
<div class="row">
<div class="col-lg-4">
<div class="testimonial-item mx-auto mb-5 mb-lg-0">
<img class="img-fluid rounded-circle mb-3" style="width:120px; height:120px;" src="https://machmit.goslar.de/wp-content/uploads/2018/12/GoslarLogoSplash@2x.png">
<img class="img-fluid rounded-circle mb-3" style="width:120px; height:120px;" src="https://machmit.goslar.de/wp-content/uploads/2018/12/GoslarLogoSplash@2x.png" alt="Logo machmit!">
<h5>MachMit! Goslar</h5>
<p class="font-weight-light">Die offene Veranstaltungsdatenbank ist eine Idee der <a href="https://machmit.goslar.de/">MachMit!-Initiative der Stadt Goslar</a>.</p>
</div>
</div>
<div class="col-lg-4">
<div class="testimonial-item mx-auto mb-5 mb-lg-0">
<img class="img-fluid rounded-circle mb-3" style="width:120px; height:120px;" src="static/img/landing-page/bg-showcase-2.jpg">
<img class="img-fluid rounded-circle mb-3" style="width:120px; height:120px;" src="static/img/landing-page/bg-showcase-2.jpg" alt="Grafik Entwicklung">
<h5>Entwicklungsphase</h5>
<p class="font-weight-light">Wir haben aktuell einen gut funktionierenden Prototypen, der gerne getestet werden darf.</p>
</div>
</div>
<div class="col-lg-4">
<div class="testimonial-item mx-auto mb-5 mb-lg-0">
<img class="img-fluid rounded-circle mb-3" style="width:120px; height:120px;" src="static/img/landing-page/machmit.jpg">
<img class="img-fluid rounded-circle mb-3" style="width:120px; height:120px;" src="static/img/landing-page/machmit.jpg" alt="Grafik Feedback">
<h5>Feedback</h5>
<p class="font-weight-light">Wir freuen uns über Anregungen, Feature-Wünsche und Kritik über die Kanäle der <a href="https://machmit.goslar.de/">MachMit!-Initiative der Stadt Goslar</a>.</p>
</div>

View File

@ -7,6 +7,10 @@
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="{% if meta_description %}{{ meta_description }}{% else %}Mit der offenen Veranstaltungsdatenbank Events einfach bekannt machen!{% endif %}">
{% if canonical_url %}
<link rel="canonical" href="{{ canonical_url }}" />
{% endif %}
{%- block metas %}
{%- endblock metas %}
@ -92,6 +96,12 @@
<title>{% block title %}{{ title|default('oveda') }}{% endblock title %}</title>
{% if structured_data %}
<script type="application/ld+json">
{{ structured_data | safe }}
</script>
{% endif %}
{% block header %}
{% endblock %}
{%- endblock head %}

View File

@ -3,10 +3,6 @@
{% block title %}
{{ oauth2_client.client_name }}
{% endblock %}
{% block header %}
<script type="application/ld+json">
{{ structured_data | safe }}
</script>
{% endblock %}
{% block content %}

View File

@ -4,7 +4,7 @@
{% block content %}
<h1>{{ _fsdomain('Register') }}</h1>
<form action="{{ url_for_security('register', next='manage') }}" method="POST" name="register_user_form">
<form action="{{ url_for_security('register') }}" method="POST" name="register_user_form">
{{ register_user_form.hidden_tag() }}
{{ render_field_with_errors(register_user_form.email) }}
{{ render_field_with_errors(register_user_form.password) }}

View File

@ -8,11 +8,6 @@
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='widget.css')}}" />
{{ render_widget_styles(styles) }}
{% endblock %}
{% block header %}
<script type="application/ld+json">
{{ structured_data | safe }}
</script>
{% endblock %}
{% block navbar %}
{% endblock %}
{% block content %}

View File

@ -8,7 +8,7 @@ from project.jsonld import DateTimeEncoder, get_sd_for_event_date
from project.services.event import get_event_date_with_details_or_404
from project.services.event_search import EventSearchParams
from project.views.event import get_event_category_choices, get_menu_user_rights
from project.views.utils import flash_errors, track_analytics
from project.views.utils import flash_errors, track_analytics, truncate
def prepare_event_date_form(form):
@ -47,5 +47,7 @@ def event_date(id):
"event_date/read.html",
event_date=event_date,
structured_data=structured_data,
meta_description=truncate(event_date.event.description, 300),
canonical_url=url_for("event_date", id=id, _external=True),
user_rights=get_menu_user_rights(event_date.event),
)

View File

@ -1,6 +1,7 @@
import json
import os.path
from flask import redirect, render_template, request, url_for
from flask import redirect, render_template, request, send_from_directory, url_for
from flask_babelex import gettext
from markupsafe import Markup
@ -15,7 +16,16 @@ def home():
track_analytics("home", "", request.args["src"])
return redirect(url_for("home"))
return render_template("home.html")
structured_data = json.dumps(
{
"@context": "http://schema.org",
"@type": "WebSite",
"name": "Oveda",
"url": url_for("home", _external=True),
}
)
return render_template("home.html", structured_data=structured_data)
@app.route("/example")
@ -71,3 +81,9 @@ def developer():
app.logger.info("No file at %s" % all_path)
return render_template("developer/read.html", dump_file=dump_file)
@app.route("/robots.txt")
@app.route("/favicon.ico")
def static_from_root():
return send_from_directory(app.static_folder, request.path[1:])

View File

@ -105,3 +105,10 @@ def send_mails(recipients, subject, template, **context):
def non_match_for_deletion(str1: str, str2: str) -> bool:
return str1 != str2 and str1.casefold() != str2.casefold()
def truncate(data: str, length: int) -> str:
if not str:
return str
return (data[: length - 2] + "..") if len(data) > length else data