spencedog1337
spencedog1337

Reputation: 35

ApostropheJS Include apostrophe-blog content on home page

I am using the apostrophe-blog module to create a blog on my website. I understand how to include a preview of each blog on my apostrophe-blog-pages/views/index.html page. I would like to include a preview of my most recently posted blog on my home page. Is there a way to get my apostrophe-blog-pieces data for my home page?

Upvotes: 1

Views: 220

Answers (1)

Stuart Romanek
Stuart Romanek

Reputation: 2157

With apostrophe-blog-widgets installed (part of the apostrophe-blog bundle) you can add a blog widget to the homepage by adding a singleton somewhere in the homepage template like

{{ apos.singleton(data.page, 'blogPreview', 'apostrophe-blog') }}

Then configure the widget to pull from All with a limit of 1, this will pull the most recent post.

Customize the view by overriding lib/modules/apostrophe-blog/lib/modules/apostrophe-blog-widgets/widget.html

Upvotes: 3

Related Questions