platzky 0.2.6__tar.gz → 0.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {platzky-0.2.6 → platzky-0.2.8}/PKG-INFO +1 -1
- {platzky-0.2.6 → platzky-0.2.8}/platzky/platzky.py +3 -1
- {platzky-0.2.6 → platzky-0.2.8}/platzky/seo/seo.py +8 -16
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/base.html +3 -9
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/body_meta.html +0 -1
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/head_meta.html +1 -2
- {platzky-0.2.6 → platzky-0.2.8}/pyproject.toml +1 -1
- {platzky-0.2.6 → platzky-0.2.8}/README.md +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/__init__.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/blog/__init__.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/blog/blog.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/blog/comment_form.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/config.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/db/__init__.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/db/db.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/db/db_loader.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/db/google_json_db.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/db/graph_ql_db.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/db/json_db.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/db/json_file_db.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/models.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/plugin_loader.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/plugins/google-tag-manager/entrypoint.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/plugins/redirections/entrypoint.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/plugins/sendmail/entrypoint.py +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/static/blog.css +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/404.html +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/blog.html +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/feed.xml +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/home.html +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/page.html +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/post.html +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/robots.txt +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/templates/sitemap.xml +0 -0
- {platzky-0.2.6 → platzky-0.2.8}/platzky/www_handler.py +0 -0
|
@@ -130,7 +130,9 @@ def create_app_from_config(config: Config) -> Engine:
|
|
|
130
130
|
blog_prefix=config.blog_prefix,
|
|
131
131
|
locale_func=engine.get_locale,
|
|
132
132
|
)
|
|
133
|
-
seo_blueprint = seo.create_seo_blueprint(
|
|
133
|
+
seo_blueprint = seo.create_seo_blueprint(
|
|
134
|
+
db=engine.db, config=engine.config, locale_func=engine.get_locale
|
|
135
|
+
)
|
|
134
136
|
engine.register_blueprint(blog_blueprint)
|
|
135
137
|
engine.register_blueprint(seo_blueprint)
|
|
136
138
|
|
|
@@ -5,7 +5,7 @@ from os.path import dirname
|
|
|
5
5
|
from flask import Blueprint, current_app, make_response, render_template, request
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def create_seo_blueprint(db, config: dict[str, t.Any]):
|
|
8
|
+
def create_seo_blueprint(db, config: dict[str, t.Any], locale_func: t.Callable[[], str]):
|
|
9
9
|
seo = Blueprint(
|
|
10
10
|
"seo",
|
|
11
11
|
__name__,
|
|
@@ -21,20 +21,13 @@ def create_seo_blueprint(db, config: dict[str, t.Any]):
|
|
|
21
21
|
return response
|
|
22
22
|
|
|
23
23
|
@seo.route("/sitemap.xml")
|
|
24
|
-
def
|
|
25
|
-
if domain_to_lang := config["DOMAIN_TO_LANG"]:
|
|
26
|
-
return sitemap(domain_to_lang[request.host])
|
|
27
|
-
else:
|
|
28
|
-
return sitemap(
|
|
29
|
-
config.get("TRANSLATION_DIRECTORIES")
|
|
30
|
-
) # TODO should be based on localization not on config
|
|
31
|
-
|
|
32
|
-
def sitemap(lang):
|
|
24
|
+
def sitemap():
|
|
33
25
|
"""
|
|
34
26
|
Route to dynamically generate a sitemap of your website/application.
|
|
35
27
|
lastmod and priority tags omitted on static pages.
|
|
36
28
|
lastmod included on dynamic content such as seo posts.
|
|
37
29
|
"""
|
|
30
|
+
lang = locale_func()
|
|
38
31
|
|
|
39
32
|
global url
|
|
40
33
|
host_components = urllib.parse.urlparse(request.host_url)
|
|
@@ -43,17 +36,16 @@ def create_seo_blueprint(db, config: dict[str, t.Any]):
|
|
|
43
36
|
# Static routes with static content
|
|
44
37
|
static_urls = list()
|
|
45
38
|
for rule in current_app.url_map.iter_rules():
|
|
46
|
-
if not
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
static_urls.append(url)
|
|
39
|
+
if rule.methods is not None and "GET" in rule.methods and len(rule.arguments) == 0:
|
|
40
|
+
url = {"loc": f"{host_base}{rule!s}"}
|
|
41
|
+
static_urls.append(url)
|
|
50
42
|
|
|
51
43
|
# Dynamic routes with dynamic content
|
|
52
44
|
dynamic_urls = list()
|
|
53
45
|
seo_posts = db.get_all_posts(lang)
|
|
54
46
|
for post in seo_posts:
|
|
55
|
-
slug = post
|
|
56
|
-
datet = post
|
|
47
|
+
slug = post.slug
|
|
48
|
+
datet = post.date.split("T")[0]
|
|
57
49
|
url = {"loc": f"{host_base}/{slug}", "lastmod": datet}
|
|
58
50
|
dynamic_urls.append(url)
|
|
59
51
|
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="{{ current_language }}">
|
|
3
3
|
<head>
|
|
4
|
-
{% block head_meta %}
|
|
5
4
|
{% include "head_meta.html" %}
|
|
5
|
+
{% block head_meta %}{% endblock %}
|
|
6
|
+
{{ dynamic_head | safe }}
|
|
6
7
|
|
|
7
|
-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
|
|
8
|
-
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
|
|
9
|
-
crossorigin=""/>
|
|
10
|
-
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css" />
|
|
11
|
-
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.Default.css" />
|
|
12
|
-
<link rel="stylesheet" href="{{ font.url }}">
|
|
13
|
-
{% endblock %}
|
|
14
8
|
<title>{% block title %}{{app_name}}{% endblock %}</title>
|
|
15
9
|
<meta name="description" content=" {% block description %} {% endblock %} ">
|
|
16
10
|
<style>
|
|
@@ -98,7 +92,7 @@
|
|
|
98
92
|
<i class="fas fa-sliders-h"></i>
|
|
99
93
|
</button>
|
|
100
94
|
{% endif %}
|
|
101
|
-
<a class="navbar-brand" href="/">{% if logo_url %}<img src="{{ logo_url }}" class="logo">{% else %}{{_(app_name)}}{% endif %}</a>
|
|
95
|
+
<a class="navbar-brand" href="/">{% if logo_url %}<img src="{{ logo_url }}" alt="{{ app_name }} logo" class="logo">{% else %}{{_(app_name)}}{% endif %}</a>
|
|
102
96
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
|
103
97
|
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
104
98
|
<i class="fas fa-bars"></i>
|
|
@@ -4,4 +4,3 @@
|
|
|
4
4
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
|
5
5
|
|
|
6
6
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
|
7
|
-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="">
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<link rel="alternate" hreflang="{{ current_language }}" href="{{ request.base_url }}"/>
|
|
5
5
|
<link rel="shortcut icon" href="{{ favicon_url }}" type="image/x-icon">
|
|
6
6
|
<link rel="canonical" href="{{ request.base_url }}"/>
|
|
7
|
+
<link rel="stylesheet" href="{{ font.url }}">
|
|
7
8
|
|
|
8
9
|
<!-- Bootstrap CSS -->
|
|
9
10
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
|
@@ -22,6 +23,4 @@
|
|
|
22
23
|
href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
|
|
23
24
|
rel='stylesheet' type='text/css'>
|
|
24
25
|
|
|
25
|
-
{{ dynamic_head | safe }}
|
|
26
|
-
|
|
27
26
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='blog.css') }}">
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|