@@ -37,30 +37,43 @@ @defthing[default-authorname string? #:value "Joel Dueck"] Used as the default author name for @code{note}s, and (possibly in the future) for articles generally. -@deftogether[(@defthing[articles-path path-string? #:value "articles"] - @defthing[series-path path-string? #:value "series"])] +@deftogether[(@defthing[articles-folder path-string? #:value "articles"] + @defthing[series-folder path-string? #:value "series"])] -The path of the folder that contains the Pollen source documents for Articles and Series +The names of the folders that contain the Pollen source documents for Articles and Series respectively, relative to the project’s document root. @deftogether[(@defproc[(articles-pagetree) pagetree?] @defproc[(series-pagetree) pagetree?])] These are project-wide pagetrees: @racket[articles-pagetree] contains a pagenode for every Pollen -document contained in @racket[articles-path], and @racket[series-pagetree] contains a pagenode for -every Pollen document in @racket[series-path]. The pagenodes themselves point to the rendered +document contained in @racket[articles-folder], and @racket[series-pagetree] contains a pagenode for +every Pollen document in @racket[series-folder]. The pagenodes themselves point to the rendered @tt{.html} targets of the source documents. -@section{Metas and @code{txexpr}s} +@defproc[(here-output-path) path?] + +Returns the path to the current output file, relative to @racket[current-project-root]. If no metas +are available, raises an error. This is like what you can get from the @tt{here} variable that Pollen +provides, except it is available outside templates. + +@defproc[(here-id [suffix (or/c (listof string?) string? #f) #f]) string?] + +Returns the 8-character prefix of the SHA1 hash of the current document’s output path. If no metas +are available, raises an error. If @racket[_suffix] evaluates to a string or a list of strings, they +are appended verbatim to the end of the hash. -@defproc[(attr-present? [name symbol?] [attrs (listof pair?)]) boolean?] +This ID is used when creating URL fragment links within an article, such as for footnotes and index +entries. As long as the web version of the article is not moved to a new URL, the ID will remain the +same, which ensures deep links using the ID don’t break. The ID also ensures each article’s internal +links will be unique, so that links do not collide when multiple articles are being shown on +a single HTML page. -Shortsightedly redundant to @code{attrs-have-key?}. Returns @code{#t} if @racket[_name] is one of -the attributes present in @racket[_attrs], otherwise returns @code{#f}. +@section{Metas and @code{txexpr}s} @defproc[(maybe-attr [key symbol?] [attrs txexpr-attrs?] [missing-expr any/c ""]) any/c] Find the value of @racket[_key] in the supplied list of attributes, returning the value of @racket[_missing-expr] if it’s not there. @@ -154,10 +167,24 @@ @defproc[(series-title) string?] If @code{(current-metas)} has the key @racket['series], and if the corresponding series defines a meta value for @racket['title], then return it, otherwise return @racket[""]. + +@defproc[(invalidate-series) (or/c void? boolean?)] + +If the current article specifies a @racket['series] meta, and if a corresponding @filepath{.poly.pm} +file exists in @racket[series-folder], attempts to “touch” the last-modified timestamp on that file, +returning @racket[#t] on success or @racket[#f] on failure. If either precondition is not true, +returns @|void-const|. + +When an article is being rendered, that means the article has changed, and if the article has +changed, its series page (if any) should be updated as well. Touching the @filepath{.poly.pm} file +for a series page triggers a re-render of that page when running @tt{make web} to rebuild the web +content (see @repo-file{makefile}). + +Only used in one place, @repo-file{tags-html.rkt}. @defproc[(disposition-values [str string?]) any] Given a string @racket[_str], returns two values: the portion of the string coming before the first space, and the rest of the string.