Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e8377adcf5 | |||
| f4beb15a3b | |||
| da447d2873 | |||
| f46bff6ec6 |
@@ -27,7 +27,7 @@ def display_page(path):
|
|||||||
except PermissionError:
|
except PermissionError:
|
||||||
abort(400)
|
abort(400)
|
||||||
except IsADirectoryError:
|
except IsADirectoryError:
|
||||||
return redirect(f'{path}/', code=301)
|
return redirect(f'/{path}/', code=301)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@@ -58,7 +58,9 @@ def display_page(path):
|
|||||||
page_title = f'{page_name} - {app.config["TITLE_SUFFIX"]}' if page_name else app.config['TITLE_SUFFIX']
|
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)
|
logger.debug("title (potentially derived): %s", page_title)
|
||||||
|
|
||||||
return render('base.html', title=page_title, description=get_meta_str(md, 'description'),
|
template = get_meta_str(md, 'template') if md.Meta.get('template') else 'base.html'
|
||||||
|
|
||||||
|
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,
|
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'))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ body {
|
|||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.site-wrap-wide {
|
||||||
|
max-width: 95pc;
|
||||||
|
min-height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<h1>NOT FOUND</h1>
|
<h1>NOT FOUND</h1>
|
||||||
<p>Sorry, <b><tt>{{ request.path }}</tt></b> does not seem to exist, at least not anymore.</p>
|
<p>Sorry, <b><tt>{{ request.path }}</tt></b> does not seem to exist, at least not anymore.</p>
|
||||||
<p>It's possible you followed a dead link on this site, in which case I would appreciate it if you could email me via:
|
<p>It's possible you followed a dead link on this site, in which case I would appreciate it if you could email me at
|
||||||
{{ config.CONTACT_EMAIL }} and I can take a look. I make an effort to symlink old content to its new location,
|
{{ config.CONTACT_EMAIL }} and I can take a look. I make an effort to symlink old content to its new location,
|
||||||
so old links and URLs should, generally speaking, work.</p>
|
so old links and URLs should, generally speaking, work.</p>
|
||||||
<p>Otherwise, I suggest you go <a href="/">to the index</a> and navigate your way (hopefully) to what
|
<p>Otherwise, I suggest you go <a href="/">to the index</a> and navigate your way (hopefully) to what
|
||||||
|
|||||||
38
incorporealcms/templates/base-wide.html
Normal file
38
incorporealcms/templates/base-wide.html
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<title>{{ title }}</title>
|
||||||
|
{% if title %}<meta property="og:title" content="{{ title }}">{% endif %}
|
||||||
|
{% if description %}<meta property="og:description" content="{{ description }}">{% endif %}
|
||||||
|
{% if image %}<meta property="og:image" content="{{ image }}">{% endif %}
|
||||||
|
<meta property="og:url" content="{{ base_url }}">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename=user_style) }}">
|
||||||
|
<link rel="icon" href="{% if config.FAVICON %}{{ config.FAVICON }}{% else %}{{ url_for('static', filename='img/favicon.png') }}{% endif %}">
|
||||||
|
|
||||||
|
<div class="wide-site-wrap">
|
||||||
|
{% block header %}
|
||||||
|
<div class="header">
|
||||||
|
<div class="nav">
|
||||||
|
{% for nav in navs %}
|
||||||
|
<a href="{{ nav.1 }}">{{ nav.0 }}</a>
|
||||||
|
{% if not loop.last %} » {% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="styles">
|
||||||
|
<a href="?style=dark">[dark]</a>
|
||||||
|
<a href="?style=light">[light]</a>
|
||||||
|
<a href="?style=plain">[plain]</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% block body %}
|
||||||
|
<div class="content">
|
||||||
|
{{ content }}
|
||||||
|
</div>
|
||||||
|
<footer>
|
||||||
|
<i>Last modified: {{ mtime }}</i>
|
||||||
|
</footer>
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -193,3 +193,13 @@ def test_setting_selected_style_includes_cookie(client):
|
|||||||
assert b'dark.css' in response.data
|
assert b'dark.css' in response.data
|
||||||
assert b'light.css' not in response.data
|
assert b'light.css' not in response.data
|
||||||
assert style_cookie.value == 'dark'
|
assert style_cookie.value == 'dark'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pages_can_supply_alternate_templates(client):
|
||||||
|
"""Test that pages can supply templates other than the default."""
|
||||||
|
response = client.get('/')
|
||||||
|
assert b'class="site-wrap"' in response.data
|
||||||
|
assert b'class="wide-site-wrap"' not in response.data
|
||||||
|
response = client.get('/custom-template')
|
||||||
|
assert b'class="site-wrap"' not in response.data
|
||||||
|
assert b'class="wide-site-wrap"' in response.data
|
||||||
|
|||||||
3
tests/instance/pages/custom-template.md
Normal file
3
tests/instance/pages/custom-template.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Template: base-wide.html
|
||||||
|
|
||||||
|
testttttttttt
|
||||||
Reference in New Issue
Block a user