How the blog works

v0.0.3

Mishka Blog is a set of records, a set of admin screens that edit them, and a set of page blocks that read them. Knowing how the records relate, who can see each of them and what the blog adds to the CMS makes the screens and the settings easier to predict. This page explains that model. The steps for each task are in the how-to guides.

The records

Every record belongs to one site. The CMS can run many sites, and a blog record never crosses from one to another.

  • A post is an article. It has a status, content, a cover, an excerpt and a reading time.
  • A collection groups posts and is what readers see as a category. A collection can sit under a parent collection.
  • A tag labels posts across collections. A tag can sit under a parent tag.
  • A blogger is the public profile of one user account. Posts credit bloggers as their authors.
  • A team groups bloggers. Its members are bloggers.
  • A comment belongs to a post. A reply points at the comment it answers.

A post can have many collections, tags and authors, and each of those can have many posts. A blogger can be in many teams. Readers add records of their own: ratings, bookmarks, comment votes and follows of bloggers and teams.

What a visitor sees

A visitor sees a record only when it is in its public state and nothing locks it away from them.

RecordPublic when
PostThe status is Published.
CollectionThe status is Active.
TeamThe status is Active.
Tag, bloggerIt is not archived.
CommentThe status is Approved, and its post is open to the visitor.

Draft and scheduled posts, inactive collections and teams, pending, flagged and spam comments, and anything archived stay in the admin. Every public read is made as the visitor, so the permission locks in How blog locks work apply in the lists, the counts and the search, not only on the record's own page.

Editing, archiving and history

  • Delete archives a record. It leaves the lists and the public pages, and Restore brings it back. Delete forever removes it and its history.
  • An archived record cannot be edited. A restored post comes back as a draft. A restored collection or team comes back as active.
  • Posts, collections, tags, bloggers and teams record a version each time they change, with who changed them. You can read a version and restore it. Comments are not versioned.

Languages

A post, a collection or a tag can exist in several languages. Each language is a separate record, and the records of one document share a language group. The Posts list shows one row for each group, and each language is a chip under it. A blogger or a team is a single record in every language. A block shows one edition of each record unless you ask for a language. On a page that shows a post, a collection or a tag, the header's language dropdown offers each published edition that the reader may open, at its own slug. Publish a post in more than one language shows the steps.

How the public pages are built

The sample pages and your own pages draw the blog with components. A block reads its first page with the page, so a crawler and a reader without JavaScript get the posts themselves, and it reads later pages in the background. A link to a record goes to the site's own page for that kind of record, which is the page whose This page shows each setting names it. The page's path says how the address is made, such as /:lang/blog/:slug on the sample post page, and the site's URL mode decides the final address. See Choose where posts are read.

A page reads its rows once. When a visitor opens the address of a page that shows a post, a collection, a tag, a blogger or a team, or the blog's front page, the blog reads that record with what the page draws of it. The read is made as the visitor, so the locks apply to it. The blog hands the rows to everything that draws the page: the head, the header's language dropdown and the bar, and the blocks that show the record, its list or its search. Without the shared read, each of them would ask the database for the same record on its own.

An address that names a post, a category, a tag, a blogger or a team the site does not have answers the site's 404 page, as WordPress does, after the next page that matches the address has been tried. A record the site has but the reader may not open keeps its page, which answers with its lock.

A block takes the rows only when the page's template hands them over, as the sample pages do, and only the blocks that show the page's own record, list or search accept them. The category list, the tag cloud and the people block always read for themselves, and so does a block you place on a page of your own without handing it the rows. A page can also declare that it shows each post, collection, tag, blogger or team. The blog then fills in that page's head, structured data and permissions from the record. See Show the blog on your own pages, and Page source: read a page's rows once for the event behind the read.

What the blog adds to the CMS

  • A Blog entry in the admin sidebar, and the screens behind it.
  • Five dashboard widgets, and a Blog tab in the settings.
  • A notification to the holders of admin:dashboard:blog:post when a post is published.
  • RSS, Atom and JSON feeds of the newest posts, named in the head of the site's pages. See Blog feeds.
  • A 301 from a record's old address to its new one when a save moves it, written as a site redirect rule.
  • A job that publishes scheduled posts, a count of each post's views, and a nightly purge of old daily views.
  • Posts, collections, bloggers and teams in the site's sitemap, with the tags that ask to be indexed, and a search and sharing head for every kind of record.
  • Share images, drawn in the background when a record is saved.
  • The components, icons and classes that posts use, added to the site's stylesheet. The components reach it when a page draws a post's body, as blog-post-detail does.
  • The kinds of record a page can show: post, collection, tag, blogger and team.
  • One read of the rows a blog page shows, shared by its head, its frame and its blocks.
  • A bar under the site's header with the blog's name and its four places, Posts, Categories, Tags and People. The blog also hands the layout the languages of the record a page shows, for the header's language dropdown. See Page frame: languages and the section bar.
  • An installer, which writes the components, pages and permission names for a site and registers the bar's words in the site's translations.

A site that never sets the blog up gets none of the components or sample pages, and the other sites on the installation are unaffected.

Views

The blog counts a post's views without a database write for each one. A view is counted in memory when a post's page is shown in a reader's browser, and each server writes what it counted once a minute, as one row for each post and day. The Analytics screen and the view figures on the dashboard read those rows. Nothing about the reader is stored. See Read the blog analytics.

Scheduled posts

A post with the Scheduled status and a time is published when its time comes, by a job the host runs once a minute. The post gets that time as its publish date and loses its schedule, and the publish notifies as any other does. See Write and publish a post and Set up the blog on a site.

Example: the life of a post

  1. An editor adds a post. It is a draft, visible only in the admin, and its first version is recorded.
  2. The editor files it under a collection, adds tags and credits two bloggers, and saves again. That is version two.
  3. The editor clicks Publish. The post gets a publish date and appears on the blog pages and in search. The other holders of admin:dashboard:blog:post are notified. If its content uses a component, icon or class that no other published post uses, the site's stylesheet is rebuilt. The site's feeds are built again on the next request.
  4. A reader comments. The comment is pending until a moderator approves it.
  5. The editor later restricts the collection with a permission. The post is now left out for readers who do not hold it.
  6. The editor archives the post. It leaves the public pages and stays in the archive with its history.