allow pages to supply extra footer text
This commit is contained in:
parent
21ea24ffa1
commit
0f03ad6f38
|
@ -76,6 +76,8 @@ def handle_markdown_file_path(resolved_path):
|
|||
page_title = f'{page_name} - {app.config["TITLE_SUFFIX"]}' if page_name else app.config['TITLE_SUFFIX']
|
||||
logger.debug("title (potentially derived): %s", page_title)
|
||||
|
||||
extra_footer = get_meta_str(md, 'footer') if md.Meta.get('footer') else None
|
||||
|
||||
template = get_meta_str(md, 'template') if md.Meta.get('template') else 'base.html'
|
||||
|
||||
# check if this has a HTTP redirect
|
||||
|
@ -86,7 +88,8 @@ def handle_markdown_file_path(resolved_path):
|
|||
|
||||
return render(template, title=page_title, description=get_meta_str(md, 'description'),
|
||||
image=get_meta_str(md, 'image'), base_url=request.base_url, content=content,
|
||||
navs=parent_navs, mtime=mtime.strftime('%Y-%m-%d %H:%M:%S %Z'))
|
||||
navs=parent_navs, mtime=mtime.strftime('%Y-%m-%d %H:%M:%S %Z'),
|
||||
extra_footer=extra_footer)
|
||||
|
||||
|
||||
def request_path_to_instance_resource_path(path):
|
||||
|
|
|
@ -72,6 +72,10 @@ footer {
|
|||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.extra-footer {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
{{ content }}
|
||||
</div>
|
||||
<footer>
|
||||
<i>Last modified: {{ mtime }}</i>
|
||||
{% if extra_footer %}<div class="extra-footer"><i>{{ extra_footer|safe }}</i></div>{% endif %}
|
||||
<div class="footer"><i>Last modified: {{ mtime }}</i></div>
|
||||
</footer>
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
|
|
@ -210,3 +210,11 @@ def test_pages_can_supply_alternate_templates(client):
|
|||
response = client.get('/custom-template')
|
||||
assert b'class="site-wrap site-wrap-normal-width"' not in response.data
|
||||
assert b'class="site-wrap site-wrap-double-width"' in response.data
|
||||
|
||||
|
||||
def test_extra_footer_per_page(client):
|
||||
"""Test that we don't include the extra-footer if there isn't one (or do if there is)."""
|
||||
response = client.get('/')
|
||||
assert b'<div class="extra-footer">' not in response.data
|
||||
response = client.get('/index-but-with-footer')
|
||||
assert b'<div class="extra-footer"><i>ooo <a href="a">a</a></i>' in response.data
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Title: Index
|
||||
Footer: ooo <a href="a">a</a>
|
||||
|
||||
# test index
|
||||
|
||||
this is some test content
|
Loading…
Reference in New Issue