scribe : documentation

Customizing Scribe

This document is for Scribe's SVN release, which can be significantly different than previous releases. Get old docs here: 0.60.

This document will help explain how to customize the look and feel of Scribe.

Appearance

Style sheets

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.

Templates

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.

base.html

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:

  • sidebar — A scribe.core.helpers.sidebar.Sidebar object that allows rendering of of the sidebar. Either use {{ sidebar }} or {{ sidebar.render }} to render it.

list.html

This template is used to render any list of articles.

Variables:

  • paginator — An extras.paginator.Paginator object that knows which articles are on the current page and how many pages there are.
  • alt_links — Defined if there are any syndication feeds for this list. It’s a list of scribe.core.helpers.TypedURL instances.
  • short — Always True for lists (and might be removed in a future version of Scribe).

article.html

This template is used to render articles when they are viewed independently. It should include a comment form for people to post comments.

Variables:

  • article — A scribe.models.Article object representing the article.
  • comment_preview — A scribe.models.Comment object if the user pressed the preview button for the form. Otherwise, it is None.
  • comment_created — A scribe.models.Comment object if the user just successfully created a comment. Otherwise, it is None.
  • comment_form — The scribe.form.Comment form used to display a comment form. You must add Submit and Preview buttons yourself.

article_snippet.html

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:

  • article — A scribe.models.Article object representing the article.
  • short — A boolean indicating whether this is displayed in a list or not. True indicates that it’s in a list. False indicates that it’s not.

comment-snippet.html

This template is for rendering an individual comment.

Variables:

  • comment — A scribe.models.Comment object representing the comment.

comment.email

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:

  • comment — A scribe.models.Comment object representing the comment.
  • host — A string containing the host computer name. This does not contain http:// or a trailing /. e.g. fadingred.org

rss/feed.xml

This template is used to create the syndication feeds.

Variables:

  • articles — A list of scribe.models.Article objects of the length defined by the preference ARTICLES_ON_FEED
  • updated — A datetime object representing the date and time of the most recent change to the articles.
  • host — A string containing the host computer name. This does not contain http:// or a trailing /. e.g. fadingred.org
  • html_link — A scribe.core.helpers.TypedURL object representing the page that contains the articles in HTML format.
  • self_link — A scribe.core.helpers.TypedURL object representing the page being rendered. (Might possibly be removed in the future)
  • category_filter — Defined to a scribe.models.Category object if the feed is being generated for a category.
  • archive_filter — Defined to a scribe.models.ArticleArchive object if the feed is being generated for an archive.
  • tag_filter — Defined to a scribe.models.Tag object if the feed is being generated for a tag.

atom/feed.xml

Same as rss/feed.xml

rss/article_snippet.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:

  • article — A scribe.models.Article object representing the article.

atom/article_snippet.xml

Same as rss/article_snippet.xml

Functionality

Preferences

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

BLOG_TITLE

This is used in templates everywhere the name of your weblog appears.

TEMPLATE_DIR

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.)

MEDIA_BASE

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

ARTICLES_PER_PAGE

The number of articles displayed per page.

ARTICLES_ON_FEED

The number of articles displayed in news (RSS) feeds.

SPAMFILTER

The name of the spam-filter plugin used. This name should be in all lowercase. See the spam-filter page for more information.

TEXTPROCESSOR

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.

NOTIFY_ON_SPAM

If you want to receive email notification when a SPAM comment is made on your blog then set this to True.

USER_CLASS

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.

LOGIN_REQUIRED

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.

LOGOUT

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.

VIEW_DECORATOR

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.

Plugins

Writing plugins for Scribe can give you a lot of control over what Scribe is doing. For more information, see the plugin pages:

Questions/Feedback

If you notice errors with this documentation, please open a ticket and let us know!