Micolog

主题设计指南

Micolog的主题模板使用django0.96模板,所以,所有django0.96的模板语言里所定义的一些标记,在Micolog里都可以使用.点击这里查看Django模板语法Django模板系统

概述

Micolog的主题放置在/themes目录下,以文件夹或zip文件的方式保存。可以通过后台管理页面,设置自己喜欢的主题。

主题文件由Html和Django模板标记组成。

结构

一般每个Theme下都会包含以下文件,假设我们的主题名字为mytheme

  1. 模板文件
    放在子目录templates(如:/themes/mytheme/templates)下,这是系统直接调用的文件,以.html格式存放,Micolog根据这些文件生成相应的页面。
  2. 其他文件
    除了模板文件之外的所有静态文件(html,css,js,swf...)都可以直接放置在主题的根目录(如:/themes/mytheme)下。

模板文件

基本模板文件

文件名 描述
base.html 主模板文件
category.html 目录
comments.html 评论
error-101.html 用户自定义错误页面
error-102.html 用户自定义错误页面
error.html 错误页面
error404.html 404错误页面
index.html 首页
month.html 归档页面
page.html Page页面
sidebar.html 侧边栏
single.html 文章页面
tag.html 标签页面

模板标签说明

注意:如需此模板首部添加pingback地址,请遵从Pingback规范添加以下Link元素:
<link rel="pingback" href="{{blog.baseurl}}/rpc" />

base.html
{{ blog.title}}: 博客标题
{{ blog.subtitle}} 博客副标题
{{ blog.feedurl }} RSS地址
/static/wlwmanifest.xml Windows Live Writer编辑器配置文件
{{ blog.theme_name }} 当前主题名称
{{blog.baseurl}} 根域名
{{self.m_list_pages}} 自定义页面列表
{{self.logouturl}} 用户退出
{{ blog.author }} blog作者
{{ self.login_user.email }} 当前用户email
{{ self.login_user.nickname }} 当前用户名
{% block title %} {{ blog.title}}{% endblock %} 标题块
{% block head_block %}{% endblock %} 头部文件块
{%if ishome%}current_page_item{%else%}page_item{%endif%} 判断是否当前页为首页(若为首页则显示current_page_item,否则page_item)
{{self.m_list_pages}} 页面列表 (page页面列表)
{% block topmenu %}{% endblock %} 顶部菜单(生成)
{%if self.is_admin%}{%endif%} 判断是否是admin
{%if self.is_login%}{%endif%} 判断是否是登录用户
{%block content %}{%endblock%} 通用页面中间内容部分

index.html
{% extends "base.html" %} 继承自base.html
{% block content%}{% endblock %} 定义content块替换base.html中的此块
循环中
{{entry.key}} 文章Key
{{entry.key.id}} 文章ID
{{entry.title}} 文章标题
{{entry.author}} 文章作者
/{{ entry.link }} 文章URL
{{entry.edit_url}} 文章编辑地址
{{entry.date|datetz:"F jS, Y"}} 文章时间(具体参数可以参照php语言的时间格式化)
{{entry.content_excerpt}} 文章简介
{{entry.commentcount}} 评论数量
{% if entry.strtags %}Tags: {%for tag in entry.tags%}{{tag}} {%endfor%}{%endif%} 文章tags循环(附加判断是否有tags)
{% if show_next %}Older Posts »{%endif%} 下一页
{% if show_prev %}« Newer Posts{%endif%} 上一页

siderbar.html
{% for comment in recent_comments %}
{{comment.author}}:{{comment.shortcontent}}... {%endfor%} 最近评论(循环列表)
{%for next in entry.next%}
{{next.title}}>>
{%endfor%} 下一篇文章
{%for prev in entry.prev%}
<<{{prev.title}}
{%endfor%} 上一篇文章
{{ entry.content }} 文章正文

comments.html
{{entry.comments.count}} 文章评论数量
{%cycle alt1,alt %} 文章评论间隔(奇数编号的评论为alt1,偶数为alt)

category.html
{{category.name}} 分类名称

相关阅读

micolog 模板的制作-illacrimo-plus-1
micolog 模板的制作-illacrimo-plus-2
micolog 模板的制作-illacrimo-plus-3
micolog模板标签及主题制作教程