platzky 0.2.8__py3-none-any.whl → 0.2.10__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/config.py CHANGED
@@ -15,6 +15,7 @@ class StrictBaseModel(BaseModel):
15
15
  class LanguageConfig(StrictBaseModel):
16
16
  name: str = Field(alias="name")
17
17
  flag: str = Field(alias="flag")
18
+ country: str = Field(alias="country")
18
19
  domain: t.Optional[str] = Field(default=None, alias="domain")
19
20
 
20
21
 
platzky/platzky.py CHANGED
@@ -94,10 +94,12 @@ def create_engine(config: Config, db) -> Engine:
94
94
  def utils():
95
95
  locale = app.get_locale()
96
96
  flag = lang.flag if (lang := config.languages.get(locale)) is not None else ""
97
+ country = lang.country if (lang := config.languages.get(locale)) is not None else ""
97
98
  return {
98
99
  "app_name": config.app_name,
99
100
  "languages": languages_dict(config.languages),
100
101
  "current_flag": flag,
102
+ "current_lang_country": country,
101
103
  "current_language": locale,
102
104
  "url_link": url_link,
103
105
  "menu_items": app.db.get_menu_items(),
@@ -20,6 +20,7 @@ def process(app, plugin_config):
20
20
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id="""
21
21
  + gtm_id
22
22
  + """
23
+ "
23
24
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
24
25
  <!-- End Google Tag Manager (noscript) -->
25
26
  """
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
- @seo.route("/sitemap.xml")
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
- # Dynamic routes with dynamic content
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
platzky/static/blog.css CHANGED
@@ -107,7 +107,7 @@ img::-moz-selection {
107
107
  background: transparent;
108
108
  }
109
109
  #mainNav .navbar-brand {
110
- padding: 10px 20px;
110
+ padding: 0px 20px;
111
111
  color: #000;
112
112
  }
113
113
  #mainNav .navbar-brand:focus, #mainNav .navbar-brand:hover {
@@ -179,7 +179,7 @@ header.masthead .overlay {
179
179
  header.masthead .page-heading,
180
180
  header.masthead .post-heading,
181
181
  header.masthead .site-heading {
182
- padding: 200px 0 150px;
182
+ padding: 100px 0 85px;
183
183
  color: white;
184
184
  }
185
185
 
@@ -187,7 +187,7 @@ header.masthead .site-heading {
187
187
  header.masthead .page-heading,
188
188
  header.masthead .post-heading,
189
189
  header.masthead .site-heading {
190
- padding: 200px 0;
190
+ padding: 100px 0;
191
191
  }
192
192
  }
193
193
 
@@ -1,5 +1,5 @@
1
1
  <!doctype html>
2
- <html lang="{{ current_language }}">
2
+ <html lang="{{ current_language }}-{{ current_lang_country }}">
3
3
  <head>
4
4
  {% include "head_meta.html" %}
5
5
  {% block head_meta %}{% endblock %}
@@ -49,6 +49,19 @@
49
49
  max-width: 80vw;
50
50
  overflow-y: auto;
51
51
  color: white;
52
+ z-index: 999999999;
53
+ }
54
+
55
+ .language-indicator-text {
56
+ color: white;
57
+ font-weight: normal;
58
+ }
59
+
60
+ #languages-menu {
61
+ background-color: {{ secondary_color }};
62
+ padding: 5px 10px;
63
+ border-radius: 5px;
64
+ color: white;
52
65
  }
53
66
 
54
67
  .offcanvas-lg.offcanvas-start {
@@ -68,6 +81,7 @@
68
81
  .dropdown-menu {
69
82
  z-index: 1;
70
83
  }
84
+
71
85
  .btn {
72
86
  padding: 0;
73
87
  }
@@ -86,7 +100,7 @@
86
100
  {% endblock %}
87
101
  <div class="container-fluid d-flex flex-column h-100 g-0">
88
102
  <div class="row header-row bg-light g-0">
89
- <nav class="navbar navbar-expand-lg navbar-light p-3" id="mainNav">
103
+ <nav class="navbar navbar-expand-lg navbar-light px-3 py-1" id="mainNav">
90
104
  {% if self.left_panel() %}
91
105
  <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#left-panel" aria-label="Toggle left panel">
92
106
  <i class="fas fa-sliders-h"></i>
@@ -110,6 +124,7 @@
110
124
  <div id="language-dropdown" class="btn-group">
111
125
  <button type="button" class="nav-link dropdown-toggle btn btn-link" id="languages-menu" role="button"
112
126
  data-bs-toggle="dropdown" aria-expanded="false">
127
+ <span class="language-indicator-text">{{ current_language }}</i>
113
128
  <i class="fi fi-{{ current_flag }}"></i>
114
129
  </button>
115
130
  <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="languages-menu">
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: platzky
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary: Not only blog engine
5
5
  License: MIT
6
6
  Requires-Python: >=3.10,<4.0
@@ -2,7 +2,7 @@ platzky/__init__.py,sha256=cEAqMh-FU8mbfCzFQaWMhKX4lDjoxDiQ9S4hTNsSOMg,160
2
2
  platzky/blog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  platzky/blog/blog.py,sha256=caBUewnwd6QrJDv20m4JDfDDjiVu7hM0AJnoTyCdwM4,3009
4
4
  platzky/blog/comment_form.py,sha256=4lkNJ_S_2DZmJBbz-NPDqahvy2Zz5AGNH2spFeGIop4,513
5
- platzky/config.py,sha256=WStlXnvoa9sCGPqKW6FuN1GIcp_MIV08FjPME9TD7x4,2204
5
+ platzky/config.py,sha256=zJhUEKdnO5YelO2uvcYnW4xc2uW1kU87KdlDpx01CCs,2246
6
6
  platzky/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  platzky/db/db.py,sha256=SayR69Nxs9aGMfYumLyLIH0LVLVmwiQt9WAICq59gng,2709
8
8
  platzky/db/db_loader.py,sha256=CuEiXxhIa4bFMm0vi7ugzm7j3WycilGRKCU6smgIImE,905
@@ -11,15 +11,15 @@ platzky/db/graph_ql_db.py,sha256=aIqRxPV-Txr5MY2-qVALby9fHyIvWgvSz2t24M9SNRI,734
11
11
  platzky/db/json_db.py,sha256=AtZoTcM6S2ZHo19rxkCi4h4E4INGieZ4W6H5O2iormA,3246
12
12
  platzky/db/json_file_db.py,sha256=UQ8TadELmqOzj_tgNfmzhtCkDkMAgcB9vaUy0GQXUY4,1010
13
13
  platzky/models.py,sha256=-IIlyeLzACeTUpzuzvzJYxtT57E6wRiERoRgXJYMMtY,1502
14
- platzky/platzky.py,sha256=6DROf-0y51ouruGwbAZM9bJ7JNqQqO27ievlnbSCdEE,4570
14
+ platzky/platzky.py,sha256=0Dgx7XdwJW0R3wVGg44JuvsoDafMuRHoJuTslbFOzlY,4708
15
15
  platzky/plugin_loader.py,sha256=KYLDSEd_hseAgBuSbikerU_IFx-YmcYK5UwYw7kla2E,1106
16
- platzky/plugins/google-tag-manager/entrypoint.py,sha256=yY5UqFvSdj3tt2upwNS8JkTrKcrbwlaaE2XQ6sRiGLc,1011
16
+ platzky/plugins/google-tag-manager/entrypoint.py,sha256=Z4npXtmCdrSuUG_ZvFdPhUZg5QcwIPGQWj9Uw9dcm8A,1021
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=1_ADEomIBz8nQXeKk48gxZfkanYTKGy53s9JV5rvn2Q,2257
20
- platzky/static/blog.css,sha256=jF-8ykgpbPp58SCUqygBhCm4o7ggULojbxpnk6Jbx3c,7895
19
+ platzky/seo/seo.py,sha256=N_MmAA4KJZmmrDUh0hYNtD8ycOwpNKow4gVSAv8V3N4,2631
20
+ platzky/static/blog.css,sha256=TrppzgQbj4UtuTufDCdblyNTVAqgIbhD66Cziyv_xnY,7893
21
21
  platzky/templates/404.html,sha256=EheoLSWylOscLH8FmcMA4c6Jw14i5HkSvE_GXzGIrUo,78
22
- platzky/templates/base.html,sha256=kvN_rLS0K6esgI0rpsZ2iGbu5z3JTBsjBRAflMpFkiI,4496
22
+ platzky/templates/base.html,sha256=Qptra-3pElumq0xuYErdyV35QDBQkRGmWF74_buXDfA,4869
23
23
  platzky/templates/blog.html,sha256=aPl-DzLX85bHv7tN8UjlABR086PUJ9IGlGbIBioFHGA,1281
24
24
  platzky/templates/body_meta.html,sha256=bRHG_BF-jloBLXASrpJVO6hDfpzq3MqMpJTXt9fLHJk,323
25
25
  platzky/templates/feed.xml,sha256=I9cz7vnxx-TfbLIDHFXfrC3S2Nt9B6PrWf3u4zSIi78,863
@@ -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.8.dist-info/METADATA,sha256=vY6JcBSYc-T5XQa0u_ZjLgIbZFhwRE8DL5ie12TH_hc,1591
34
- platzky-0.2.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
35
- platzky-0.2.8.dist-info/RECORD,,
33
+ platzky-0.2.10.dist-info/METADATA,sha256=ANwGZHe0wn3ofx-l2TsiCZjxGSVOsNSPQ7-5k6foVvI,1592
34
+ platzky-0.2.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
35
+ platzky-0.2.10.dist-info/RECORD,,