Post list widget.

Description

Now that we have a way to specify blog posts in and have them be generated into the correct directory structure, we need some sort of landing page for blogs. Create a <mummy:PostList> which will:

  • Gather all the child posts.

  • Sort them by publication date (which probably means posts need to get some sort of publishedOn property automatically). Maybe sort them secondarily by slug.

  • For each child post generate some block of content containing:

    • Title (probably as a link).

    • Publication date, in localized format.

    • A teaser (which means we need to have some API somewhere to retrieve a teaser from the content).

    • Keywords. (Keywords need to be added later as part of a coordinated conceptualization of keywords and searching.)

    • A link to "read more", either internationalized or some symbols. Use a moreLabel attribute to specify the text, and default to "…".

There are so many variations for blog landing pages that it would be impossible to cover many of them, much less all of them. The idea here is to produce some basic blog widget, and allow more customization after expression evaluation is supported—either as general content in any old page, and/or as a <mummy:template> section inside <mummy:PostList>.

Environment

None

Activity

Show:
Garret Wilson
February 28, 2020, 3:31 AM
Edited

Thinking in more general terms, it's likely someone would want to put some such widget on any main index page to list all the pages below it, perhaps with excerpts. So maybe we're talking about a general <mummy:Index> widget. Actually the index.html file is probably misnamed. A better name would probably be "directory", such as a directory of shops in a building, a telephone directory, or a web directory.

Even though we don't yet have an expression language, the widget could still allow configuration of the different heading labels via property name. Here's a first pass at what it might look like:

Some unresolved questions:

  • How would we distinguish between literal text such publishedOn and the actual artifact publishedOn property? Maybe we need to use {{^{page.publishedOn}}}—but we need to be careful about presupposing what form the expression language will take. And even if we did provide an expression, how would we indicate that it has delayed evaluation (a difference the JSP/JSF unified expression language allows to be denoted with a different symbol). We need to be careful not to build to much here ahead of time.

  • How would we indicate that things like publishedOn should be converted, not to an ISO 8601 local date string, but to a locale-sensitive full version of the local date?

  • How would we indicate fallbacks (e.g. from title to label to filename)?

One obvious solution to the first point would be to indicate "property" in the attribute:

But that could get cumbersome if we have too many variations e.g. of what sort of thing to put in <h2>. (Note also that excerpt isn't really a property—not of the resource description, anyway. It requires special knowledge of how to extract an excerpt.)

Garret Wilson
February 22, 2020, 9:03 PM

A better name is probably <PostList>. Nothing ties it directly to a "blog". And it could have lots of configuration options. The first one to start with is moreLabel, the label to indicate on the link label under the excerpt.

Garret Wilson
February 21, 2020, 9:46 PM

There's a page that talks about how long an excerpt should be. Interestingly, though, it links to another page discussing whether the landing page should have full or partial posts. In fact I've seen some blogs that provide full posts on the landing page. Maybe that should be added as an option in the future.

Garret Wilson
February 21, 2020, 9:22 PM
Edited

We need to decide on the correct terminology for the "teaser" of the blog entry.

  • It looks like in the old Marmot content management system I wrote, I had a com.globalmentor.marmot.resource.xhtml.getExcerpt(final Element element) method that returned a DocumentFragment.

  • Jekyll also uses the term "excerpt", using the first paragraph by default or allowing an excerpt_separator to be specified.

  • Hugo uses the word "summary", using the first 70 words by default or wherever the <!--more--> "summary divider" is placed. Hugo's documentation also notes:

    The concept of a summary divider is not unique to Hugo. It is also called the “more tag” or “excerpt separator” in other literature.

  • WordPress has an "excerpt" field that is used as a "summary". If it isn't explicitly given, the first 55 words of the post are used.

So it appears that "excerpt" is a popular term. To me "summary" doesn't have quite the same semantics.

Garret Wilson
February 21, 2020, 6:12 PM

One difficulty for future improvement will be determining how to handle many entries. For the meantime we can just throw in all the entries on the same page, but at some point we'll need to have some sort of paging mechanism (see some of the sample blogs for examples). This might involve generating extra pages, which conflicts somewhat with the idea that this is a widget on a page.

Longer term we'll may want to add facilities to Guise to load arbitrary content from the static site at runtime and update the content using standard Ajax stuff. This general idea would make Guise really powerful and start giving it data processing capabilities.

Fixed

Assignee

Garret Wilson

Reporter

Garret Wilson

Labels

None

Components

Fix versions

Priority

Major