Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Theme and Layout

Wu Yuxin edited this page Jul 9, 2018 · 3 revisions

Require Knowledge: Html and Css.

Default Layout we use: Miyano Template.

Firstly, These DIY stuff are all in the layout folder.

In the layout folder, you must have 3 things basically - index.html.erb, post.html.erb and default.scss. You can change the content of them, but you cannot change these filenames.

Erb Template

We use index.html.erb to indicate Home Page and Per Tag Page, post.html.erb to indicate Per Post Page.

You can use ruby with the erb template.

<% ruby code %>dose not write the output of the ruby code, usually used in Control Flow.

<%= ruby code %> writes the output of the ruby code, usually uses the instance's method we passed in.

index.html.erb has a instance of Site defined here.

post.html.erb has a instance of Post defined here

Site

It's used in the Home Page and Tag Page, so it has all posts and tags, and current tag.

  • method posts returns an array of all posts you exported in *.bearnote.

  • method tags returns a map, its (key, value) is (tag, count).

  • method current_tag indicate the current tag in the Tag Page

Post

  • date(format="%b %-d, %Y") - the last modified time.

  • tags - all tags this post has

  • summary - a string of summary, e.g. <%= summary[0..length] %> to indicate whatever length you want.

  • title

  • name - the filename of bearnote, used in the url.

  • url

  • content - the web content of this post (converted html)

  • text - unconverted/origin bear text

  • content_no_assets - if you want to post all content on the Home Page. Better speed without assets(imgs, files).

  • content_for_homepage - if you want to post all content with asserts on the Home Page.

Check the default layout as an example: Miyano Template.

Clone this wiki locally