This document will help explain how to customize the look and feel of Scribe.
Most appearance customization of Scribe can be done via CSS style sheets. We recommend this for users who don’t really want to quickly change the look of Scribe but don’t want to change the layout of the page too much.
The following style sheets are included with Scribe:
| Style Sheet Name | Usage |
|---|---|
| scribe.css | Included on all pages. |
| forms.css | Included on all pages with forms. |
| admin.css | Included on all administrative pages. |
| code.css | Included on all pages. |
You can look through the HTML and CSS and modify colors and layout to the extent that is possible with CSS. If this is not sufficient for you, you can modify the templates that Scribe defines and create your own setup.
Additional configuration can be done by changing templates. The following table shows the different templates that Scribe uses and what variables each template receives. Each template is explained in more detail later.
| Template Name | Variables |
|---|---|
| base.html | sidebar |
| list.html | paginator, short, alt_links |
| article.html | article, comment_preview, comment_created, comment_form |
| article_snippet.html | article, short |
| comment-snippet.html | comment |
| comment.email | comment, host |
| rss/feed.xml | articles, updated, host, html_link, self_link, category_filter, archive_filter, tag_filter |
| atom/feed.xml | articles, updated, host, html_link, self_link category_filter, archive_filter, tag_filter |
| rss/article_snippet.xml | article |
| atom/article_snippet.xml | article |
| sidebar/*.html |
In addition, there are templates for the administrative pages, but it is rare that you will want to modify those.
All other templates extend this template. Modifying it will allow you to change the style of your blog quickly to match your current site design.
Variables:
This template is used to render any list of articles.
Variables:
This template is used to render articles when they are viewed independently. It should include a comment form for people to post comments.
Variables:
This template is used to render articles when they are viewed independently or in a list. It is simply the output of the article.
Variables:
This template is for rendering an individual comment.
Variables:
This is the text that will be sent when a comment is posted on an article. It will be sent to the person who wrote the article. The host variable gives quick access to the name of the site Scribe is running on.
Note: Whitespace is significant in this template.
Variables:
This template is used to create the syndication feeds.
Variables:
Same as rss/feed.xml
This template is used to render articles when they are viewed on a feed. This exists because feed.xml uses it. feed.xml is the only template that uses it, so it it may not exist in a future version.
Variables:
Same as rss/article_snippet.xml
Each item in your list of SIDEBAR_ITEMS has it’s own template in this directory. You can modify it to change the look of the sidebar.
If your had SIDEBAR_ITEMS = ['tags', 'archives'], then two corresponding templates need to be created. They are sidebar/tags.html and sidebar/archives.html. Each sidebar plugin defines content that goes by the same name as the plugin. It’s best explained with an example. The file sidebar/tags.html could look something like this:
<h2>Tags</h2>
<ul>
{% for tag in tags %}
<li><a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a></li>
{% endfor %}
</ul>
In the example above, the variable tags is defined by the tags plugin to be a list of tags. The output of this template is joined with the rest of the sidebar items in the list of SIDEBAR_ITEMS. For more information, read the sidebar plugins document.
The following table outlines the different preferences that are available in Scribe. They are explained in more detail below.
| Variable | Type | Default Value |
|---|---|---|
| BLOG_TITLE | String | 'My new weblog' |
| SIDEBAR_ITEMS | List of Strings | ['categories', 'tags', 'archives'] |
| TEMPLATE_DIR | String | '' |
| MEDIA_BASE | String | '/scribemedia' |
| ARTICLES_PER_PAGE | Integer | 5 |
| ARTICLES_ON_FEED | Integer | 10 |
| SPAMFILTER | String | None |
| TEXTPROCESSOR | String | 'markdown' |
| NOTIFY_ON_SPAM | Boolean | False |
| USER_CLASS | Model | django.contrib.auth.models.User |
| LOGIN_REQUIRED | View Decorator | scribe.conf.glogal_settings.login_required |
| LOGOUT | View Decorator | scribe.conf.glogal_settings.logout |
| VIEW_DECORATOR | View Decorator | None |
This is used in templates everywhere the name of your weblog appears.
The items to have in your sidebar and the order in which you want them.
This should be set to the relative directory in which your templates reside.
For example, if you want Scribe to look for your templates in a subdirectory called blog, you would set TEMPLATE_DIR = 'blog/'.
(Note: This directory should be a directory within one of the directories in your Django TEMPLATE_DIRS list.)
This should be set to the base location at which your media files are located.
Examples:
MEDIA_BASE = '/media/' # hosted on the same server MEDIA_BASE = 'http://media.fadingred.org/' # hosted on a different server
The number of articles displayed per page.
The number of articles displayed in news (RSS) feeds.
The name of the spam-filter plugin used. This name should be in all lowercase. See the spam-filter page for more information.
The name of the text-processor plugin used. This name should be in all lowercase. The default is markdown, which comes prepackaged with Scribe. See the text-processor page for more information.
If you want to receive email notification when a SPAM comment is made on your blog then set this to True.
For those users who want to customize how users log in and out of Scribe, they can customize the user class that is used. The user class must be a Django model, and it must be stored in the request object when a user is logged in (request.user should yield the currently logged in user).
Unless you have a real need to change this (to integrate with your current user infrastructure, for example), we recommend that you leave it as its default.
You will most likely only want to change this preference if you changed the USER_CLASS preference. It is the decorator that is used on all administrative pages.
Like the LOGIN_REQUIRED preference, you’ll probably only want to change this if you changed the USER_CLASS preference. It is the function that is called to log a user out. It also handles redirecting the user to a valid page.
This decorator is added to every view within Scribe. If it is defined, it will be used, and you can modify all views or just about any view to your liking. Scribe uses a RenderingHttpResponse that allows you access to the template_name, dictionary, and context_instance attributes that will later be used to render the view. This gives you full control over what variables or what templates Scribe will render.
Writing plugins for Scribe can give you a lot of control over what Scribe is doing. For more information, see the plugin pages:
If you notice errors with this documentation, please open a ticket and let us know!