logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

App::DocKnot::Spin::Sitemap - Generate page navigation links for spin

Author

       Russ Allbery <rra@cpan.org>

Class Methods

       new(PATH)
           Create a new App::DocKnot::Spin::Sitemap object for the .sitemap file specified by PATH.

Description

       App::DocKnot::Spin supports sitemap information stored in a ".sitemap" file at the top of the source
       directory.  If this is present, it is used to add navigation information to every generated page.

       App::DocKnot::Spin::Sitemap encapsulates parsing of that file and generating the HTML for inter-page
       links.  It can also generate HTML for the entirety of the sitemap to support the "\sitemap" thread
       command.

       The format of this file is one line per web page, with indentation showing the tree structure.  Each line
       should be formatted as a partial URL (relative to the top of the site) starting with "/", a colon, and a
       page description.  The partial URL should be for the generated pages, not the source files (so, for
       example, should use an ".html" extension).  The top of the generated site should have the URL of "/" at
       the top of the sitemap.

       If two pages at the same level aren't related and shouldn't have next and previous links to each other,
       they should be separated by three dashes on a line by themselves at the same indentation level.

       Here's an example of a simple .sitemap file:

           /personal/: Personal Information
             /personal/contact.html: Contact Information
             ---
             /personal/projects.html: Current Projects
           /links/: Links
             /links/lit.html: Other Literature
             /links/music.html: Music
             /links/sf.html: Science Fiction and Fantasy

       This defines two sub-pages of the top page, "/personal/" and "/links/".  "/personal/" has two pages under
       it that are not part of the same set and therefore shouldn't have links to each other.  "/links/" has
       three pages under it which are part of a set and should be linked between each other.

Instance Methods

       links(PAGE)
           Generate  the  "<link>"  tags for the provided PAGE, which should be a URL relative to the top of the
           generated site and starting with "/".  The return value is a  list  of  lines  to  add  to  the  HTML
           "<head>" section, or an empty list if the page was not found in the sitemap.

       navbar(PAGE)
           Generate  the  navigation bar for the provided PAGE, which should be a URL relative to the top of the
           generated site and starting with "/".  The return  value  is  a  list  of  HTML  lines  suitable  for
           injecting into the output page.

       sitemap()
           Return  the  sitemap  as a list of lines of formatted HTML, suitable for inclusion in a generated web
           page.  This is used to implement the "\sitemap" thread command.

Name

       App::DocKnot::Spin::Sitemap - Generate page navigation links for spin

Requirements

       Perl 5.24 or later and the List::SomeUtils and Path::Tiny modules, both of which are available from CPAN.

See Also

docknot(1), App::DocKnot::Spin

       This  module  is  part of the App-DocKnot distribution.  The current version of DocKnot is available from
       CPAN, or directly from its web site at <https://www.eyrie.org/~eagle/software/docknot/>.

perl v5.38.2                                       2024-07-14                   App::DocKnot::Spin::Sitemap(3pm)

Synopsis

           use App::DocKnot::Spin::Sitemap;
           my $sitemap = App::DocKnot::Spin::Sitemap->new('/path/to/.sitemap');
           my @links = $sitemap->links('some/output/page.html');
           my @navbar = $sitemap->navbar('some/output/page.html');

See Also