List feature [core]

In order to allow for lists to be created, we need to have a plugin that generates indexes of all the data the user wants to list (but no more than what the user wants to avoid wasting time updating useless indexes.)

As the system moves forward, it can add new indexes dynamically, so we don't have to offer one specific list from the start. This being said, we want lists of all the pages (since pages are users, that includes users too.)

The lists can then be used to display pages as in a blog (i.e. newest to oldest, display title & teaser, etc.) It can be used to show the latest 3 posts or comments, etc.

We want to optimize these as much as possible so we can retrieve what we need in a snap.

IMPORTANT NOTE

The Cassandra Database is to include a list of ALL the websites that are created in it. This means the table of contents will include pages from ALL the websites. It is important to be noted since lists on Site A will most certainly not want to list pages from Site B.

See: Forum feature

See: Comment feature

See: Blog feature

See: Lists

See: C-like Expressions

See: Feed feature [core] (Atom, RSS 2.0, etc.)

Meta Tags for SEO

Lists will be duplicating your content. It is a good thing to have lists of content as they give search engines a way to find all your content, but it is dangerous to have too much duplication on your website.

By default, all lists (Exception maybe the front page of a blog) should be marked with the no-index meta tag.

As of 2012, we can also link pages of a list with the <link rel="next" href="..."> and <link rel="prev" href="...">. In case we have a page with the entire content from the list (some form of show all pages) then we can send the search engines to that page with a <link rel="canonical" href="...">. All 3 links are welcome.

Obviously, other relative links can be used (home, end, etc.) to navigate the list.

Technical Implementation Details

The implementation of lists has three parts:

  1. Check whether a page is included in a list,
  2. Define a key so the items of a list can be sorted appropriately,
  3. A layout that defines how the list is displayed.

The following describe each part as they work at a lower level so I can remember how I did all of that.

Checking Pages

Any new page or modified pages is registered by the list plugins so it can quickly be checked for inclusion or exclusion in lists. The list of pages that change is saved in the list table, one column per page in a row named after the website URI.

A backend works on getting the lists up to date. This works by doing to things: first it checks the pages that were newly created and pages that were modified against all the lists. The lists are known because any page that represents a list is linked to the list content type.

To know whether a page is part of a list we run a small C-like expression which has to return true or false. If true, then the page is viewed as part of the list. If false, the page is not part of the list. The C-like expression offers a cell() function which can be used to read data from the Cassandra database. The function allows the list implementation to generate very advanced queries since the full power of a C-like expression is available (all operations against integers, floating point, strings, and binary buffers.) We'll grow the number of functions available as we grow Snap! For example, you could get the first letter of a title and include only pages that have a title that starts with an "A" character.

Item Key

To sort the items of a list, you want to have a key. The key is built using the different parameters that you define in a C-like expression. The key can be a string or a binary array.

The C-like expression uses the same capabilities available to the page check. This means you can read any cell() and use the content to build the key. For example, you could read the title in order to sort pages by title. For a blog though, you'd want to use the largest integer minus the creation date (the subtraction is used to get a descending ordered list of pages.)

IMPORTANT NOTE

At this point the sorting itself is done using the Cassandra binary sort which means that the sorting is not language specific which will certainly be a problem in the long term. We'll look into creating the lists using the language by creating the lists in a different table for each language. At this points the lists are simply created in the content table.

Layout

The list makes use of a layout which goes around and peek for data to be displayed in the list. This is technically the same as any layout, only it gets applied to each item in the list one after another.

The layout may make use of the page title, teaser, categories, etc. just like any layout.

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly