The "Pages" Database Table
A description of the fields or columns in the "Pages" database table of HS-CMS
- Table Overview
- The Fields
- Field: id
- Field: url
- Field: type
- Field: format
- Field: file
- Field: description
- Field: status
- Field: created
- Field: updated
- Field: tags
- Field: comments_enabled
- Field: render_engine
- Field: skin_andor_theme
- Field: feed_friendly
- Field: robot_friendly
- Field: index_friendly
- Field: cache_friendly
- Field: content_has_heading
- Field: shortlink
- Questions? Contact me
Overview
Each of your sites will have its own Pages table.
In theory, this table is created when you run the automated
All the pages in your HS-CMS powered site, even if they are actually static files and not ever touched by HS-CMS, should have at least one entry in this table. Fields, values, and implications are listed below.
Fields
Column: id
This is the page ID and, is more accurately, a unique id for the row in the database. Do not specify its value ever; MySQL should automatically assign one. If you do assign it, it needs to be unique.
Other tables, such as one containing comments, can use this field as a "foreign ID."
Column: url
This is the URL the public can see, after the domain. The url
field should never contain
opening or trailing slashes, with the exception of the home page,
which is just a slash: /
Thus the following are examples:
/
about
company/history
learn/css/hacks
contact
(If this seems bizarre, well maybe it is. I borrow convention from Drupal here, and improve upon it; at least you have no node/foo URLs! Also, fewer slashes means quicker typing and fewer mistakes!)
If you want the trailing slash I just told you to avoid, that's ok. There is a configuration option to use trailing slashes. However you should still not add them here. (Subject to change.)
It is worth noting that in the case of app pages, any requests not matching another page but beginning with the app's url will be handled by the app. If they should really result in a 404, it is the application's job to raise that error.
Also, this is the "match" part of an alias. If the URL ends with the percent sign, %, that symbol considered a wildcard and the URL will, like apps (which do not require the asterisk), match URLs beginning with that URL. (If an app does not want the expanded matching capabilities, it should be a 'dynamic' page instead.)
Column: type
This field is just an ENUM
, or list of several
allowed values, but is very complex in its implications.
Please see the Type field of the Pages table page.
Column: format
This is a VARCHAR(255)
and you can specify any valid list of comma-separated formats.
Valid formats include markdown
, xhtml
, php
, and any other
formats you install.
For aliases, if this column is set to soft
a soft redirect will be performed.
Column: file
If this is a page or app of some sort, this field needs to contain the relative path to the content for this page from hscms/sites/yoursite/content/ It should not start with a slash. Note that this can include pages not in your /content/ folder -- a useful way to to share pages between sites, for example. WARNING: This is a potential security risk, AND the editing of such a page would only show up as a revision in one site. Examples of non-alias file fields:
- aboutus.text
- contact.php
- foo/bar.xhtml
- ../../../copyrights/_HS_Copyrights_READ_ME.text
Important: For alias-type pages, "file" is not the path to a file, but rather the exact URL of the real page. No asterisk is ever necessary in this field, even for wildcard aliases. Note, if this is an alias to a page on your site (same domain), you don't need (and, for portability, shouldn't put) the http://example.com
part of the URL. So if you have resume
redirect to cv
, don't put http://example.com/cv
in the file
field, just put cv
. Aliases are hard redirects by default, but can be soft if the format
field
is set to soft
.
Column: description
Obviously, a description of the page. Will be used in the meta description tag (which shows up on search engines) and across the site, say, in
lists. Should not include HTML or anything special. This field is a TEXT
field.
Column: status
The status is fairly straightforward, except for that it is represented by a tinyint to save space. Values:
- -10 indicates deleted and will result in an HTTP
410 Gone
status which indicates to user agents and spiders that the content has been permanently removed. - -1 indicates unpublished draft and is not publicly viewable, but is intended to be so soon.
- 0 indicates hidden and only viewable by the administrator(s).
- 1 indicates published and fully viewable by anyone.
- 2 indicates published draft and fully viewable by anyone (at a secret URL), but this status confers official draft status and changes default visibility to robots, indexes, and feeds.
Only positive statuses are to be shown to the public.
Other possible values could be added in the future; they will follow the conventions only statuses with numerical values greater than or equal to 1 being publicly visible, however.
Note This even applies to aliases and all types of pages.
Column: created
This field is of the MySQL DATETIME
type, and stores the creation date and time in YYYY-MM-DD HH:MM:SS format, 24-hour time, in the UTC timezone.
It should indicate when the material was first published, but is your discretion if you wish to use this field for the time your content was added to your HS-CMS powered website (automatic/leave blank) or when published anywhere (i.e., backdate).
Column: updated
This field is also of the MySQL DATETIME
type, and stores the date and minute of the last content update in YYYY-MM-DD HH:MM:SS format, 24-hour time, in the UTC timezone.
It should be initialized to the same value as created.
Column: tags
Tags is simply a comma-separated list of tags, up to 255 characters of them (i.e. it is VARCHAR(255)
). (Unicode characters which are two bits may cut down this limit.) In theory you should be able to convert this column to TEXT
Column: comments_enabled
- 3 forces comment reading & writing
- 2 allows comment reading & writing (rules such as time limit may apply)
- 1 displays comments but disables writing
- 0 allows for default, based on rule & page type
- -1 disallows comment reading or writing
Column: render_engine
This can be left blank for the site's default rendering engine, or filled in
with a rendering engine short name. VARCHAR(127)
.
Rendering engines can be within the render_engines
folder of either hs_core or of a particular site (usually the latter).
This field (and your config_site.php
) should use values like "banana" for a banana-themed rendering engine saved as banana.render.php
.
Column: skin_andor_theme
This column, which can be left blank, is a VARCHAR(255)
which should be handled entirely by your rendering engine. Hint: Use IDs, not strings, to avoid using too many characters.
Column: feed_friendly
Feeds are considered anything like RSS, Atom, or other alerting mechanisms that may exist in the future, maybe XMPP or PubSubHubBub or Wave-powered.
- 1 to override the default feed visibility to allow inclusion in feeds
- 0 for the default feed visibility (that is, based on page type - typically only pages of type
authored
,representative
(?), orwiki
are included) - -1 to override the default feed visibility to disallow inclusion in feeds
Column: robot_friendly
- 1 to override the default robot visibility to allow bots
- 0 for the default robot visibility (that is, allow robots to crawl it based on page type; expect pages of type
error
to be excluded) - -1 to override the default robot visibility to disallow bots (useful for shareable but secret drafts)
Column: index_friendly
- 1 to override the default index inclusion to allow this page in the sitemap, nav menu, etc.
- 0 for the default index inclusion (that is, decide based on page type - basically only pages of type
error
oralias
will be excluded) - -1 to override the default index visibility to disallow this page in the sitemap, nav menu, etc. (useful for shareable but secret drafts)
Column: cache_friendly
If the whole page output is cached for visitors.
- 1 to override the default and allow allow whole-page caching
- 0 for the default caching behavior (that is, only cache pages with certain types like
authored
,static
, andwiki
but notdynamic
orapp
) - -1 to override the default and disallow whole-page caching
Does not affect the caching of components and function calls made while generating the page.
Column: content_has_heading
Whether or not the content itself has an <h1>
within itself, i.e. the page title should not be inserted into full-page (non-AJAX) rendered HTML. Note that if this is true, the RSS script will attempt to remove the H1 from the page.
- 0 for no, the content does not already have an
<h1>
(default) - 1 for yes, it already has an
<h1>
(or is automatically generating its own, if it's a page of app or dynamic type)
Column: shortlink
An optional field containing a "short URL" or "shortlink" such as one from http://tinyurl.com, http://bit.ly, http://is.gd, or one's own URL shortening service (such as http://ajh.us). This must be a fully-qualified URI/URL.
Example: http://ajh.us/2
Bad example: /2
HS-CMS should by default send a Link: <http://example.com/tiny>; rel=shortlink
header
in response to requests for pages
The shortlink is also available as $HS_page['shortlink'] to render engines.
Contact
If you have questions after carefully reading this page or have corrections to suggest, please do not hesitate to contact me.