All page models support over 40 different attributes such as a Title, H1. Meta Data, JavaScript References, CSS References, Layout Selection, Login Requirements, Preamble, Link Text, Functional Security, et cetera.
Suppose you are asked to cut a piece of wood, which saw do you choose?
It is impossible to make a proper selection without knowing more information. Will you be making a rough cut or a fine cut? Will the cut be straight or curved? Are you cutting a log or a board?
In a similar way, web developers using GenHelm always try to choose the best model based on how well the model aligns with the content they seek to build. In many cases the choice will be quite apparent. For example, if you are building a Frequently Asked Questions page you will likely want to use the FAQ model. If you are creating a form, you will use the form model, for a links page you would normally want the links model, et cetera.
In cases where GenHelm does not supply a model that closely aligns with what you are trying to build you generally have two choices:
Normally, you will only build a new model if you anticipate the need to create similar types of pages on a recurring or ongoing basis. If you are creating a "one off" page, you would do so using one of the general-purpose models.
Suppose you are tasked with building a page that includes the following content:
Follow these simple instructions to prepare great deviled eggs.
Let's review some of the general-purpose page models that you could use.
Often the "go to" model for simple content pages is the wysiwyg model. This is what the specification would look like using this model.
The tags model is another general-purpose model that can be used to create any set of HTML tags as shown here:
One of the features of the tags model is that certain content can be excluded for mobile or desktop devices. For example, if your page includes a large image that can't be shown properly on a phone you could exclude this image for such devices by selecting desktop in the last column for the rows to be excluded.
The markdown model can be used to create HTML syntax from a simple text syntax invented by John Gruber of Daring Fireball as shown here:
The custom model is usually used for pages that include dynamic content that needs to be created programmatically. Nevertheless, it can be used to build this simple recipe page for Illustration purposes. When using the custom model, you must supply a generate function that returns the content to be included in the page as shown here.
One thing to note about all of these pages is that they include the recipe as part of an ordered list. What if you wanted to show this same recipe on multiple pages of your site? The way we have built these pages, we could easily share the entire page content by embedding the content into another page using a $page reference such as $page(deviled-egg-recipe). However, we would have no way of embedding only the list item without the surrounding H2 and introduction.
To overcome the limitations described above, GenHelm promotes the building of pages from reusable components. Rather that embedding the recipe list as we have shown, a better option would be to use the list model to define the list as a reusable component. Here is what our deviled_eggs list definition would contain:
Now that this list has been turned into a component, it can be reused on any page simply by including $list(deviled_eggs). Here we can see the simplified version of the tag model implementation.
For detailed information about all of the page-oriented models, follow the links below.