implement noscript site pages
This commit is contained in:
parent
d0ef7a6c17
commit
dabbc37252
2 changed files with 17 additions and 3 deletions
|
@ -24,9 +24,23 @@ def intro(request):
|
|||
return render_to_response('intro.html', context)
|
||||
|
||||
def index(request):
|
||||
title = settings.SITENAME
|
||||
text = settings.CONFIG['site']['description']
|
||||
page = request.path.split('/')
|
||||
if len(page) == 2:
|
||||
page = page[1]
|
||||
else:
|
||||
page = ''
|
||||
for p in settings.CONFIG['sitePages']:
|
||||
if p['id'] == page:
|
||||
title += ' - ' + p['title']
|
||||
text, created = models.Page.objects.get_or_create(name=page)
|
||||
text = text.body
|
||||
context = RequestContext(request, {
|
||||
'base_url': request.build_absolute_uri('/'),
|
||||
'settings': settings,
|
||||
'text': text,
|
||||
'title': title,
|
||||
})
|
||||
return render_to_response('index.html', context)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>{{settings.SITENAME}}</title>
|
||||
<title>{{title}}</title>
|
||||
<link rel="shortcut icon" type="image/png" href="/static/png/icon16.png"/>
|
||||
<link rel="icon" href="/static/png/icon64.png" sizes="32x32"/>
|
||||
<link rel="icon" href="/static/png/icon64.png" sizes="48x48"/>
|
||||
|
@ -27,8 +27,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<h1>{{settings.SITENAME}}</h1>
|
||||
<p>{{settings.CONFIG.site.description|safe}}</p>
|
||||
<h1>{{title}}</h1>
|
||||
<p>{{text|safe}}</p>
|
||||
<p>{{settings.SITENAME}} requires JavaScript</p>
|
||||
</noscript>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue