WebFactory Default Index Page

Introduction

WebFactory CMS 0.6 system is a simple (still very capable) CMS system for static web pages.

One main difference compared with common static site generators is that most functionality including site generation is available directly from the web interface.

The low level features of WebFactory described below is what WebFactory is without any kind of customisation. This means that most functions are accessed directly by changing URLs. In a production site, simple helpers (like HTML buttons) may be included as a convenience.

Restricted access

By default site customisation is behind a login.

Administrative users are defined directly in settings.rb. There is no support for web based user administration which may be seen as a limitation. But it simplifies the architecture and likely improve access security.

Users are automatically redirected to login page for all privileged functions.

/login

To force logout go to.

/logout

Common functions

A site consist of one or more pages. This current page is called index.

Edit this page by opening the following url.

/edit/index

This URL is also available as convenience as Edit link in top right corner.

View a pre-generated version of this page on following url.

/index

Render a new version of this page on following url.

/render/index

New pages are simply created by entering a different page name on edit URL.

Create a new page mypage by opening the following url.

/edit/mypage

All pages will be automatically created under /pages source folder which is not accessible under /public folder.

Rendered pages will be created under /public/html folder which will referenced when rendered pages are viewed.

This is the most important concepts to allow basic content updates of a webfactory site.

Pages and sections

A page is a markup file with a template configuration in the top of the page.

{{ template:default }}

Make sure to exclude any spaces within brackets. Spaces are added here just to avoid that the reference is interpreted

A page may include all the contents it needs directly in the page, but may also reference other markup parts called, sections.

Below a pre-defined page has been created as an example.

Link: apage

Links to this page is done through regular relative HTML links. E.g. from markdown.

[link title to apage](/apage)

The supported format of pages are currently (markdown or html). The wanted format is configured first time the page is created.

A page and a section look the same and are edited and created the same way. The only difference is that a page must include a template reference (in the top) to make it complete as a page. A section must not include a template reference. It already is part of a page.

To include a common section on a page (e.g. a header or footer) insert a section reference within a page. Note that spaces within brackets must be removed here as well.

{{ section:header }}

While pages and sections are editable through web interface, customization of templates is not.

The templates are found under /templates source folder e.g.

/templates/custom.html

Custom templates may be created and used by a corresponding template reference.

{{ template:custom }}

There are other static content that is only editable through source updates.

Static site CSS, javascript and content are found under regular public folder.

/public/javascripts/appliction.js
/public/stylesheets/style.css
/public/images/...
/public/fonts/...

This makes the overall solution very flexible.

Other administrative functions

A list of all pages and sections is availably under the following url

/all

All pages is rendered by via following url

/render/all

Search in all (rendered) pages via following url

/search

Advanced

Constants

Constant parameters can be defined globally in source file /config/constants.json.

Include a constant definitions by inserting constant reference anywhere within a page (spaces removed).

{{ const:name }}

Custom parameters in sections

Often a section can be used for many pages with just minor modification.

To allow reuse and avoid duplication it is possible to add custom parameters in the section reference. For instance if you want a custom message in a subsection for different pages you can supply the custom parameter as follows.

{{ section:route/asection, message="Kilroy was here!" }}

The dynamic parameters is accessed from the section as a constant reference.

{{ const:message }}

Multiple parameters are supplied separated by comma.

{{ section:route/asection, message="Kilroy was here!", version="9.9" }}

Parameters are even allowed in templates. If you e.g. use a constant title in the template it can be overridden by supplying the custom title in the template reference.

{{ template:default, title="My custom title for a page" }}

Custom parameters in sections override constant definitions.

For instance the global constant version (=0.6) is overridden in a subsection as follows.

{{ section:route/asection, message="Kilroy was here!", version="9.9" }}

Dynamic generators

If you need even more flexibility it is possible to use custom ruby code to generate content to be used on a page.

These generators works in a similar way as constants, except that custom ruby code generate the results.

def date
  Time.now.strftime("%F")
end

It is defined in source file dynamic.rb as part of class Dynamic. If you need other dynamic functions you can simply add them to the Dynamic class.

The dynamic is accessed in the same way as a constant except it is called a dynamic.

{{ dynamic:date }}

This "2024-08-07", is the result if you include a reference in a page. The dynamic data is generated when page is rendered.

Support other files

To handle common additional files like robots.txt and sitemap.xml general support for .xml and .txt files is included.

If you place one of these files in /pages folder they will be copied to /public folder when all pages are rendered (/render/all). The files may include const and dynamic references just as regular pages.

For instance this pages site map is defined as follows.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>{{ const:domain }}/index</loc>
      <lastmod>2024-08-07</lastmod>
      <changefreq>monthly</changefreq>
      <priority>0.8</priority>
   </url>
   <url>
      <loc>{{ const:domain }}/apage</loc>
      <lastmod>{{ dynamic:date }}</lastmod>
      <changefreq>monthly</changefreq>
      <priority>0.8</priority>
   </url>
</urlset> 

Note the reference to one constant domain and one dynamic date which are replaced when rendered.

These files are currently not editable via web ui.

File upload

Basic file upload is also supported by default.

/upload

Files are stored to /public/files folder by default so they are accessible via links or HTML tags from pages.

Templates

webfactory is mainly designed as a web site engine to provide common features for most web sites

The layout of a site is very flexible using webfactory

By setting the structure of a site you will have full flexibility choose the design of a site

Using this foundation any design will be possible to setup.

We have made a few sample templates to illustrate how webfactory is customized to support a new design.

XHTML and Web Security

This site is configured to follow XHTML 1.0 Strict which can be seen below.

Valid XHTML 1.0 Strict

It is very possible to support highest security rating using webfactory.

See HTTP Observatory Report.

Contact

For more information please get in touch ...