About Features Downloads Getting Started Documentation Events Support GitHub

Site Tools


configuration:static_pages

Static Pages

:!: This feature was introduced in VuFind 4.0

It is sometimes useful to host mostly-static HTML content pages within the framework of VuFind itself. The system provides a simple mechanism for serving arbitrary templates, including internationalization support.

Simple Example

For static content, simply create a new template inside the templates/content folder of your theme. You can then link to this content using the content-page route with the template name passed to the route as the 'page' parameter.

VuFind ships with an example FAQ template showing how to set up this simple scenario. The link to this page is:

<a href="<?=$this->url('content-page', ['page' => 'faq']) ?>"><?=$this->transEsc('FAQs')?></a>

It is also possible to display a content page in a lightbox by adding the data-lightbox attribute to the link:

<a href="<?=$this->url('content-page', ['page' => 'faq']) ?>" data-lightbox><?=$this->transEsc('FAQs')?></a>

Multi-language Example

The content system also supports i18n. If you create different versions of a template with filenames suffixed with a language code (e.g. faq_en.phtml, faq_de.phtml, etc.) VuFind will attempt to load the version matching the user's selected language. If no match is found, it will next attempt to load the template matching the configured default language. If that is not found, it will finally default to the non-suffixed version of the filename.

For an example, see the asklibrary.phtml and asklibrary_en.phtml templates in the content template folder.

Markdown Support

:!: This feature was introduced in VuFind 7.0.

If you prefer to build your content pages using Markdown instead of PHP templates, you can simply name the files you create under the templates/content directory of your theme with .md extensions instead of .phtml extensions, and they will be displayed appropriately. If you create both .phtml and .md files with the same base name, the .phtml file will take precedence over the .md file.

configuration/static_pages.txt · Last modified: 2020/02/26 17:34 by demiankatz