-
Notifications
You must be signed in to change notification settings - Fork 9
Folder Structure
Joomlatools Pages is a flat-file based component there is no database that underpins it, to set up Pages properly the folder structure is very important. At the top level of your Pages installation, the folder structure should resemble this:
/pages
├── about.html.php
├── products.html.php
├── contact.html.php
└── index.html.php
/layouts
├── default.html.php
└── products.html.php
/partials
├── header.html.php
├── menu.html.php
├── product.html.php
└── footer.html.php
/data
├── products.yaml
└── footer.json
/theme
├── css
├── js
├── fonts
└── images
/cache
config.php
This is the heart of Pages. The /pages
folder is where you create and edit your content. Pages are the most basic building block for content, they are special types of templates that have the ability to create URLs based on how they are arranged in your folder tree.
The simplest way of adding a page is to add an HTML file in the /pages
root directory with a suitable filename. You can also write a page in Markdown using a .md
extension which will be automatically converted to HTML on build. For a simple company site here’s what your directory structure and associated URLs might look like:
└── index.html # => http://example.com/
├── contact.html.php # => http://example.com/contact
└── company
└── index.html.php # => http://example.com/company
└── about
└── index.html.php # => http://example.com/company/about
└── team.html.php # => http://example.com/company/about/team
If you have a lot of pages, you can organise them into subfolders, a subfolder will become a subpath in your site and the index file in the folder represents the content for the folder path.
For example:
└── company.html.php # => http://example.com/company
is the same as
└── company
└── index.html.php # => http://example.com/company
File and folder names should also be valid slugs. Slugs are entirely lowercase, with accented characters replaced by letters from the Latin alphabet (a-z
) and whitespace characters replaced by a dash (-
) or an underscore (_
), to avoid being encoded.
See also: Page
Layouts are templates that wrap around your pages. They allow you to have the source code for your template in one place so you don’t have to repeat things on every page.
Layouts live in the /layouts
directory. The convention is to have a base template called default.html.php and have other layouts inherit from this as needed.
See also: Templates > Layouts
Partials are generally small and reusable chunks of template code. You can build sections of a page and reuse them on different pages without the need to repeat yourself. In other words, partials help you keep your templates clean and DRY.
Partials can live anywhere. For the sake of consistency, it is best to place them in the /partials
directory, but you can include them anywhere you want.
See also: Templates > Partials
The /data
directory is where you can store additional data for Pages to use when generating your pages. These files must be YAML, JSON, INI, PHP, XML or MD (markdown) (using either the .yml, .yaml, .json, .ini, .php, .xml, md, or extension), and they will be accessible via the data()
template function.
The /data
directory is used to store structured data. Pages offers support for different types of files YAML, JSON, INI, PHP, XML and MD (markdown).
See also: Data
Pages is build to work with any Joomla template out of the box and this will probably be the way you get started. For designers who prefer to create a custom design pages also offers the option to build a theme
either for your whole site or only for specific pages.
The /theme
directory is used to store you theme assets: css, js, images, fonts, etc making it easy for Pages to find and include them.
See also: Themes
The /cache
directory is used to store temporary cached files that are automatically generated by Pages to improve performance. By default, Pages handles caching automatically, caching is automatically disabled in debug mode.
This directory should not be used to store any user data, as it is routinely flushed of all data.
See also: Caching
Joomlatools Pages gives you a lot of flexibility to customise how it builds your pages. These options can be specified in a config.php
file placed in your /joomlatools-pages
root directory. The config file defines settings for caching, metadata, and more...
See also: Configuration
Got a question or need help? We have a forum on Github Discussions where you can get in touch with us.