make editing the title not change sidebar/banner
parent
92872444cf
commit
37c7fee1fb
|
@ -89,9 +89,8 @@ def selected_tab(request):
|
|||
return 'home'
|
||||
|
||||
@app.template_filter("seeded_random")
|
||||
def seeded_random(choices, url):
|
||||
if url.startswith('/post/'):
|
||||
random.seed(url)
|
||||
def seeded_random(choices, seed):
|
||||
random.seed(seed)
|
||||
return random.choice(choices)
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,11 @@
|
|||
{%- endmacro -%}
|
||||
|
||||
{%- macro random_image(path) -%}
|
||||
{{- SITE_FULL_IMAGES ~ "/" ~ path ~ "/" ~ listdir('files/' ~ path)|seeded_random(request.path) ~ '?x=7' -}}
|
||||
{% if request.path.startswith('/post/') and p %}
|
||||
{{- SITE_FULL_IMAGES ~ "/" ~ path ~ "/" ~ listdir('files/' ~ path)|seeded_random(p.id) ~ '?x=7' -}}
|
||||
{% else %}
|
||||
{{- SITE_FULL_IMAGES ~ "/" ~ path ~ "/" ~ listdir('files/' ~ path)|random() ~ '?x=7' -}}
|
||||
{% endif %}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro post_meta(p) %}
|
||||
|
|
Loading…
Reference in New Issue