Nocterra provides an application programming interface (API) that can be used on any page. The Nocterra API contains functions to easily enhance and customize the generated webpages on a per page basis. This documentation is both a user guide for content writers and developers who wish to enrich the generated content and perform tasks like SEO.
The API reference is not complete; it's an ongoing effort documenting the API and providing examples to document the use of the functions. Please also see the Nocterra Manual for a description of the functional principles and more comprehensive examples.
addKeywords(array|string $newKeywords): void
addKeywords(array|string $keywords, array|string $newKeywords): void
Add new keywords to the keywords already set for the current page.
Or add new keywords to the given keywords and set thiese new keywords to the current page.
Both function variants do not add new keywords to the keywords it alread present. So calling this function like addKeywrds('foo', 'bar');
on a page which already has the foo
keyword set will only add the bar
keyword.
No value is returned.
addMenuItem(
string $menuItem,
string $language,
string $link,
string $name
): void
Add an item to the menu in the specified language. Menu items are specified by their structure in the menu. foo
would be the foo
menu at the top most level. foo/bat
would be the bar
submenu as a child of the foo
menu.
For multilingual websites an menu can be added for each language. When a language does not have a menu item added for the $menuItem
during URL generation an URL will be generated to the deepest menu item that is present in that language, either by defining it in the configuration or added through this function.
If a menu item has presivously been added for $menuItem
the link
and name
will be overridden other set values will persist.
No value is returned.
setDescription(string $description): void
Sets the meta description for the current page. This description is used for SEO, as the text when people link to the page in Facebook and for Twitter cards.
No value is returned.
setEpilogue(string $epilogue): void
setEpilogue(string $epilogue, string $location): void
Sets the epilogue for the current page.
An epilogue is a user defined piece of HTML that will be inserted at the end of a page element. It is inserted after the content generated by Nocterra.
The location parameter specifies which element in the page the epilogue will be inserted. When not specified, it's at the end of the page body.
No value is returned.
setKeywords(string $keywords): void
Sets, as in replaces, the keywords for the current page.
No value is returned.
setPrologue(string $prologue): void
setPrologue(string $prologue, string $location): void
Sets the prologue for the current page.
An prologue is a user defined piece of HTML that will be inserted at the start of an page element. It is inserted before the content generated by Nocterra.
The location parameter specifies which element in the page the prologue will be inserted. When not speicifed, its at the start of the page body.
No value is returned.
setSubtitle(string $subtitle): void
Sets the subtitle for the current page.
No value is returned.
setTitle(string $title): void
Sets the title for the current page.
No value is returned.