Automattic / newspack-theme

A theme for Newspack.
https://newspack.com
GNU General Public License v2.0
300 stars 66 forks source link

Archive pages: ability to customize archive pages #941

Closed laurelfulford closed 3 years ago

laurelfulford commented 4 years ago

Right now, the Newspack theme uses the 'out of the box' WordPress approach to archive pages, with a specific layout used for all archive pages.

Publishers who have wanted to customize these pages have had to manually create a static page for each category, tag, etc they'd like to customize, build the content out of the Homepage Posts block and other blocks, and add redirects.

Ideally, it would be possible to customize the templates themselves somehow, in a way that would be applied to all archive pages, rather than doing them one at a time -- the only case where one at a time makes sense is if you want truly unique layouts for each archive, but it's more likely that a site just wants all archive pages to be different.

Related: #779, #350.

laurelfulford commented 4 years ago

A pie-in-the-sky version of this would be the ability to build a template with Homepage Posts blocks, to use on all archive pages, with the assumption that they would all use the archive's category/tag/author/what have you.

jeffersonrabb commented 4 years ago

A pie-in-the-sky version of this would be the ability to build a template with Homepage Posts blocks, to use on all archive pages, with the assumption that they would all use the archive's category/tag/author/what have you.

I like this idea very much. Could you say more about how it might work? For example, where does the template live? Would we need to mandate only one instance of the block per page? Etc?

laurelfulford commented 4 years ago

I've been thinking about this over the weekend -- these are probably not great answers, in part boxed in by how I know WordPress works -- but ya gotta start somewhere!

For example, where does the template live?

Given how things like this are currently stored, I'd imagine these templates would be stored as CPTs. If this was handled, say, in a plugin, there could also be a section where you could set those layouts for different kinds of archives, and have more than one possible layout (Category, Tag, Author, Custom Taxonomy, and even Search Results and the classic Blog Posts page -- though the latter might be getting really away from the spirit of Full-Site editing).

archive-layouts

archive-layouts-settings

Would we need to mandate only one instance of the block per page?

I don't think so, but we'd probably need to limit what blocks are used (similar to the newsletters). How it works now is basically like if you had one posts block; I imagine you'd be able to use several blocks, mixed with non-content blocks like group, columns, separators, etc. For the Homepage posts block, we'd probably want to limit some options: there wouldn't be query options outside of number of posts, and we couldn't have block-specific content -- like the section header -- but all the other visual options would be available. You'd be able to set them all up with a layout (like with patterns), and the posts in the archive would flow through it, newest to oldest. They would probably look similar to the homepage, with the latest articles using bigger, bolder, styles, eventually working down to the older ones, and possibly 'Load More' links rather than pagination.

archive-layout-exampke

Where this gets tricky is if we're using say, the same layout for all categories, you wouldn't be able to add things like image blocks, or paragraph blocks, without (presumably) the exact same content showing for each archive. So that would be cool for CTA-like content, but not cool if you wanted to have some kind of special intro or headers specific to an archive.

And would all Homepage Posts blocks then act like 'archive' blocks, or would you be able to add one to all archive pages that just showed the Latest Posts, site-wide?

We'll also probably run into things like, what if you had summary posts in a category, would people want to exclude them? Can the archive title, description, and (in the author bio case), author profile be moved/changed?

Other examples

I haven't done extensive research yet, but both Wix and Squarespace do let you change layout options for archives, but they would be a site-wide thing, and would switch the entire layout -- for example, switch to masonry, side-by-side, one column, and adjust things like spacing and number of columns (some screenshots).

This is also another option for us: put together some predefined layout templates that publishers can pick from. I think, though, we have such a cool tool in the Homepage Posts block, and can pair it with some block patterns to help folks get started, but open up a lot more possibilities.

bfrye26 commented 3 years ago

This sounds like an amazing concept! I love the idea! If something like what @laurelfulford suggested was in place, it would be a very powerful way to customize the site.

laurelfulford commented 3 years ago

I'm going to close this issue for a couple reasons:

Though we haven't opted in to FSE yet with the theme, something like this will be possible with it. So rather than reinventing the wheel, I think it would be best to tackle this as we incorporate FSE into the theme.

If there are specific full-site options (like a grid layout) that are requested, we could add more options to the Customizer, similar to #1316, and tackle that in separate issues.

iitsuraj commented 4 months ago

https://github.com/Automattic/newspack-theme/issues/941#issuecomment-633682781

is this a plugin or what? and how i can modify theme?