Testing One Two Three

Inline Gallery Mystery Solved!

If I put the gallery at the top of a post, it got included in the post summary.

There were a few times when posts with galleries of images that were also the 'index.html' post (the featured post) had a problem. Their gallery would have more images than it should.

The mystery is solved.

Any blogging system needs to have article summaries. With the Pelican system, summaries are created one of two ways.

  1. Adding a 'Summary: put-your-summary-here.' line in the metadata section of the content source file header, or
  2. Letting Pelican create the summary for you automatically.

If you choose (as I did) to let Pelican do it, Pelican uses a configuration parameter called 'SUMMARY_MAX_LENGTH' to determine how many characters of text to include in the summary. Then it pulls that many characters out of the body of the article starting at the top. The default value for that parameter is 50.

Under most circumstances this works just fine. But the 'index.html' template is unique: it creates a page with the latest post at the top and summaries of all the other posts beneath.

Each post on the site shows its title, some information (article.info), and then the article.summary, in this case, whatever is in the first 50 characters.

So, because my 'gallery : : {photo . . . ' line was within 50 characters of the start, it got included for processing by the javascript that puts the images together for display. And the only place this was visible was when you were viewing index.html. In otherwords, if the URL was just https://www.drgerg.com, the problem was visible, otherwise it was not. It was a bit baffling at first.

Phibos at Github gave me a hint, and it proved to be the nudge that got me off high center. Thanks, @phibos!

Learn something new every day.

link to home page

links