Download the PHP package omz13/kirby3-htmlsitemap without Composer
On this page you can find all versions of the php package omz13/kirby3-htmlsitemap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package kirby3-htmlsitemap
Kirby3 htmlsitemap
Requirement: Kirby 3
Documentation
Purpose
For a kirby3 site, this plugin (omz13/htmlsitemap) generates a human-facing html-based sitemap at '/sitemap'.
- Generates an html-based sitemap as a structured unordered list (
<ul>
). - Pages or their children can be excluded based in the following criteria, and in the following priority:
- The homepage is always included.
- The error page is always excluded; who wants to see the error page?
- Only pages that have a status of "published" are included, i.e. those with "draft" or "unpublished" are excluded.
- Unpublished pages can be explicitly included based on their slugname; c.f.
includeUnlistedWhenSlugIs
in Configuration. - Pages made using certain templates can be excluded; c.f.
excludePageWhenTemplateIs
in Configuration. - Pages with certain slugnames can be excluded; c.f.
excludePageWhenSlugIs
in Configuration. - Pages with a content field
excludefromhtmlsitemap
that istrue
are excluded. - Pages with a method
issunset
that returnstrue
are excluded. - Pages with a method
isunderembargo
that returnstrue
are excluded. - The children of pages made using certain templates can be excluded; c.f.
excludeChildrenWhenTemplateIs
in Configuration. - The children of pages made using certain templates can be included as anchored links to their parent; c.f.
linkyChildrenWhenTemplateIs
in Configuration.
- For debugging purposes, the generated html sitemap can include additional information as html comments; c.f.
debugqueryvalue
in Configuration.
In the current proof-of-concept, the sitemap is a presented as a simple unordered list: it is envisioned that this will be transformed into something with more aesthetics through css.
Related
For a computer-oriented xml-based sitemp, kindly see omz13/kirby3-xmlsitemap.
For a plugin that provides the methods issunset
and isunderembargo
, kindly see omz13/kirby3-suncyclepages.
Caveat
Kirby3 is under beta, therefore this plugin, and indeed kirby3 itself, may or may not play nicely with each other, or indeed work at all: use it for testing purposes only; if you use it in production then you should be aware of the risks and know what you are doing.
Roadmap
For 1.0, the non-binding list of planned features and implementation notes are:
- [x] MVP
- [x] Debugging option
- [x] Respect page status
- [x] Allow specific unlisted pages to be included c.f.
includeUnlistedWhenSlugIs
- [x] Exclusion of pages by template – c.f.
excludePageWhenTemplateIs
- [x] Exclusion of individual pages – c.f.
excludePageWhenSlugIs
- [x] Exclude embargoed pages
- [x] Exclude sunset pages
- [x] One-pager support c.f.
excludeChildrenWhenTemplateIs
andlinkyChildrenWhenTemplateIs
- [ ] If the site has content at '/sitemap', do not hijack
- [ ] Provide tags/snippets to include a html sitemap
- [ ] Allow configuration of sitemap
<div>
andclass
attributes. - [ ] Consider style using slickmap
- [ ] Consider style using Pure CSS Tree Menu
- [ ] Consider style using CSS to create a simple tree structure with connecting lines
- [ ] Consider style using Nested Folders
- [ ] Cache (DoS mitigation)
- [ ] Automate GitHub release – gothub? github-release-notes?
Installation
Pick one of the following per your epistemological model:
composer require --no-dev omz13/kirby3-htmlsitemap
; the plugin will automagically appear insite/plugins
.- Download a zip of the latest release - master.zip - and copy the contents to your
site/plugins/kirby3-htmlsitemap
. git submodule add https://github.com/omz13/kirby3-htmlsitemap.git site/plugins/kirby3-htmlsitemap
.
For the record: installation by composer is cool; supporting installation by zip and submodule was an absolute pain, especially as I am an installation by composer person, so do feel guilted into getting me Coffee, Beer, etc., because this is for your benefit and not mine (and yes, I would have have preferred to spend my time somewhere warm and sunny instead of being hunched over a keyboard while the snow falls outside and the thermometer shows no inclination to get above 0C).
Configuration
The following mechanisms can be used to modify the plugin's behaviour.
via config.php
In your site's site/config/config.php
the following entries under the key omz13.xmlsitemap
can be used:
disable
: a boolean which, if true, to disable the xmlsitemap functionality (c.f.xmlsitemap
in viasite.txt
).debugqueryvalue
: a string to be as the value for the query parameterdebug
to return the sitemap page with debugging information (embedded as html comments). The global kirbydebug
configuration must also be true for this to work. The url must be to/sitemap.xml?debug=debugqueryvalue
and not/sitemap?debug=_debugqueryvalue_
(i.e. the.xls
part is important). Be aware that the debugging information will show, if applicable, details of any pages that have been excluded (so if you are using this in production and you don't want things to leak, setdebugqueryvalue
to something random). Furthermore, the site debug flag needs to be set too (i.e. thedebug
flag insite/config.php
).- !!!
includeUnlistedWhenSlugIs
: an array of slugnames whose pages are to be included if their status is unlisted. excludePageWhenTemplateIs
: an array of templates names whose pages are to be excluded from the xml-sitemap.excludePageWhenSlugIs
: an array of slug names whose pages are to be excluded from the xml-sitemap.excludeChildrenWhenTemplateIs
: an array of templates names whose children are to be ignored (but pages associated with the template is to be included); this is used for one-pagers (where the principal page will be included and all the 'virtual' children ignored).linkyChildrenWhenTemplateIs
: an array of templates names whose children are to be included as anchored links to their parent; this is used for one-pagers (where the principal page will be included and all the 'virtual' children need their own entry in the sitemap). Note that it is your responsibility to ensure that the anchor names are generated by the templates for the child pages.
For example, for the Kirby Starter Kit, the following would be applicable:
And to have a debugged sitemap returned at /sitemap?debug=wombat
, it would be:
via content fields
If a page's content has a field called excludefromxmlsitemap
and this is set to true
, then that page (and any children, if present) will be excluded. Similarly to site.txt
, this can be easily achieved in a blueprint.
As pages are implicitly included within a sitemap, this mechanism should only be used when you have a reason to explcitly exclude a page when it is not possible to do otherwise (c.f. excludePageWhenTemplateIs
).
Use
StarterKit
A sample rendered /sitemap
would look like:
And the underlying HTML is
Disclaimer
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.
License
You are prohibited from using this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.
Buy Me A Coffee
To show your support for this project you are welcome to buy me a coffee.