Run template functions based on data attributes #20

Closed
opened 2 months ago by FWDekker · 0 comments
Owner

Instead of relying on pages that use the template to run header() and similar functions, the template should run those functions based on the data embedded in, say, the meta tags or based on data attributes attached to the body. For example, using meta tags, the page using the template could include

<meta name="fwd:nav:name" value="/Tools/" />
<meta name="fwd:header:title" value="Tools" />
<meta name="fwd:header:description" value="An overview of tools I have created" />
<meta name="fwd:footer:vscURL" value="https://git.fwdekker.com/FWDekker/tools/" />
<meta name="fwd:footer:version" value="v1.4.2" />

Maybe some tags (such as fwd:header:description) are not necessary since there is also the description meta tag already. (But maybe I'll just keep the duplicate tag.)

Not including the tag means that undefined is passed to the function. Not including the value attribute in the tag means null is passed to the function. Using value="" means that the empty string is passed to the function.

Not including any fwd:footer:* tags at all means that the template will not run its footer function. To run footer with all undefined values, the tag fwd:footer should be added without the value attribute.


The advantage of this method is that pages such as the error pages do not need to include and compile scripts, which simplifies the page.

Instead of relying on pages that use the template to run `header()` and similar functions, the template should run those functions based on the data embedded in, say, the meta tags or based on data attributes attached to the `body`. For example, using meta tags, the page using the template could include ```html <meta name="fwd:nav:name" value="/Tools/" /> <meta name="fwd:header:title" value="Tools" /> <meta name="fwd:header:description" value="An overview of tools I have created" /> <meta name="fwd:footer:vscURL" value="https://git.fwdekker.com/FWDekker/tools/" /> <meta name="fwd:footer:version" value="v1.4.2" /> ``` Maybe some tags (such as `fwd:header:description`) are not necessary since there is also the `description` meta tag already. (But maybe I'll just keep the duplicate tag.) Not including the tag means that `undefined` is passed to the function. Not including the `value` attribute in the tag means `null` is passed to the function. Using `value=""` means that the empty string is passed to the function. Not including any `fwd:footer:*` tags at all means that the template will not run its `footer` function. To run `footer` with all `undefined` values, the tag `fwd:footer` should be added without the value attribute. --- The advantage of this method is that pages such as the error pages do not need to include and compile scripts, which simplifies the page.
FWDekker added the
feature
label 2 months ago
FWDekker self-assigned this 2 months ago
FWDekker closed this issue 2 months ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.