platzky 0.2.8__py3-none-any.whl → 0.2.9__py3-none-any.whl
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/seo/seo.py
CHANGED
|
@@ -20,7 +20,19 @@ def create_seo_blueprint(db, config: dict[str, t.Any], locale_func: t.Callable[[
|
|
|
20
20
|
response.headers["Content-Type"] = "text/plain"
|
|
21
21
|
return response
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
def get_blog_entries(host_base, lang, db, blog_prefix):
|
|
24
|
+
dynamic_urls = list()
|
|
25
|
+
print(blog_prefix)
|
|
26
|
+
for post in db.get_all_posts(
|
|
27
|
+
lang
|
|
28
|
+
): # TODO add get_list_of_posts for faster getting just list of it
|
|
29
|
+
slug = post.slug
|
|
30
|
+
datet = post.date.split("T")[0]
|
|
31
|
+
url = {"loc": f"{host_base}{blog_prefix}/{slug}", "lastmod": datet}
|
|
32
|
+
dynamic_urls.append(url)
|
|
33
|
+
return dynamic_urls
|
|
34
|
+
|
|
35
|
+
@seo.route("/sitemap.xml") # TODO try to replace sitemap logic with flask-sitemap module
|
|
24
36
|
def sitemap():
|
|
25
37
|
"""
|
|
26
38
|
Route to dynamically generate a sitemap of your website/application.
|
|
@@ -40,14 +52,7 @@ def create_seo_blueprint(db, config: dict[str, t.Any], locale_func: t.Callable[[
|
|
|
40
52
|
url = {"loc": f"{host_base}{rule!s}"}
|
|
41
53
|
static_urls.append(url)
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
dynamic_urls = list()
|
|
45
|
-
seo_posts = db.get_all_posts(lang)
|
|
46
|
-
for post in seo_posts:
|
|
47
|
-
slug = post.slug
|
|
48
|
-
datet = post.date.split("T")[0]
|
|
49
|
-
url = {"loc": f"{host_base}/{slug}", "lastmod": datet}
|
|
50
|
-
dynamic_urls.append(url)
|
|
55
|
+
dynamic_urls = get_blog_entries(host_base, lang, db, config["BLOG_PREFIX"])
|
|
51
56
|
|
|
52
57
|
statics = list({v["loc"]: v for v in static_urls}.values())
|
|
53
58
|
dynamics = list({v["loc"]: v for v in dynamic_urls}.values())
|
|
@@ -62,3 +67,6 @@ def create_seo_blueprint(db, config: dict[str, t.Any], locale_func: t.Callable[[
|
|
|
62
67
|
return response
|
|
63
68
|
|
|
64
69
|
return seo
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# TODO add tests which would check that sitemap is different for different languages
|
|
@@ -16,7 +16,7 @@ platzky/plugin_loader.py,sha256=KYLDSEd_hseAgBuSbikerU_IFx-YmcYK5UwYw7kla2E,1106
|
|
|
16
16
|
platzky/plugins/google-tag-manager/entrypoint.py,sha256=yY5UqFvSdj3tt2upwNS8JkTrKcrbwlaaE2XQ6sRiGLc,1011
|
|
17
17
|
platzky/plugins/redirections/entrypoint.py,sha256=yoqHsRLqRALdICs5_UMSREkfEo1Lbsjj9tqEA7dsseg,1555
|
|
18
18
|
platzky/plugins/sendmail/entrypoint.py,sha256=16GszfLaYhVUSuCdL4SPVKYN9-mONp-hK5ZWSiLluPo,1215
|
|
19
|
-
platzky/seo/seo.py,sha256=
|
|
19
|
+
platzky/seo/seo.py,sha256=N_MmAA4KJZmmrDUh0hYNtD8ycOwpNKow4gVSAv8V3N4,2631
|
|
20
20
|
platzky/static/blog.css,sha256=jF-8ykgpbPp58SCUqygBhCm4o7ggULojbxpnk6Jbx3c,7895
|
|
21
21
|
platzky/templates/404.html,sha256=EheoLSWylOscLH8FmcMA4c6Jw14i5HkSvE_GXzGIrUo,78
|
|
22
22
|
platzky/templates/base.html,sha256=kvN_rLS0K6esgI0rpsZ2iGbu5z3JTBsjBRAflMpFkiI,4496
|
|
@@ -30,6 +30,6 @@ platzky/templates/post.html,sha256=GSgjIZsOQKtNx3cEbquSjZ5L4whPnG6MzRyoq9k4B8Q,1
|
|
|
30
30
|
platzky/templates/robots.txt,sha256=2_j2tiYtYJnzZUrANiX9pvBxyw5Dp27fR_co18BPEJ0,116
|
|
31
31
|
platzky/templates/sitemap.xml,sha256=iIJZ91_B5ZuNLCHsRtsGKZlBAXojOTP8kffqKLacgvs,578
|
|
32
32
|
platzky/www_handler.py,sha256=pF6Rmvem1sdVqHD7z3RLrDuG-CwAqfGCti50_NPsB2w,725
|
|
33
|
-
platzky-0.2.
|
|
34
|
-
platzky-0.2.
|
|
35
|
-
platzky-0.2.
|
|
33
|
+
platzky-0.2.9.dist-info/METADATA,sha256=L7dz8p0DkdDThTIeqmmdX8q40-dS2SA0bt5UlYBzQCU,1591
|
|
34
|
+
platzky-0.2.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
35
|
+
platzky-0.2.9.dist-info/RECORD,,
|
|
File without changes
|