All of the template-first themes that we are building include a default home page template. These templates make sure that the theme looks like the demo when activated.
Currently the theme's home page template is not set as the home page template when activating the theme. This means the user has to select the home page template manually in the template selector.
This should be done automatically. If a home page already exists that has not been edited then we should replace it. If it has, then we should create a new draft homepage with the new template.
WIP: D31358-code
Some more context for this: paAmJe-EG-p2/#comment-1747
@apeatling D31358-code contains a first pass that's working rudimentary.
The problem we'll have again is hot-linking images. Once we side-loaded the images and replaced them, the page template won't be "unaltered" anymore and prevents a future switch.
How about we leave that page's content alone, create a new page for each theme (associated through post meta), and update the front-page assignment instead? That way we could update the images, users could update the content, and we could reuse them when a theme would be switched back to?
How about we leave that page's content alone, create a new page for each theme (associated through post meta), and update the front-page assignment instead? That way we could update the images, users could update the content, and we could reuse them when a theme would be switched back to?
The previous pages would need to be set as draft, otherwise they will continue to show up in navigation. I'm open to this as an option and trying it to see how it feels.
@apeatling Created D31499-code with this alternative approach. It's still missing image sideloading but imports/updates the homepage on theme-switch, limited to template-first themes.
This is really good, it feels amazing to activate a theme and it actually look like the demo when you visit your site.
Two things I noticed:
The "Home" title shows up when it doesn't on the demo site. Is this something we can control?

For the draft home pages of previously activated themes, could we modify the page title to "Home ([themename] theme)"? It would at least give the user greater context as to why there are a bunch of draft home pages.

If they reactivate a theme and the draft homepage is published again, update to back to "Home".
D31499-code is updated and now:

@apeatling: I think this is approaching a state where it's ready for final review.
Final question I have, what if anything, should happen if the user switches away from a template-first theme?
And just to double-check: If home is the blog listing, we only add the page in draft and nothing else?
Good questions @obenland
What if anything, should happen if the user switches away from a template-first theme?
This has come up in live chats previously. Leaving the previous theme's homepage content in place is really confusing for users and totally unexpected. My thoughts would be when switching to an old theme:
The above I think are bonuses, and we could launch without the above and loop back on this. This is currently an issue right now with our business themes when a user switches to an older theme.
And just to double-check: If home is the blog listing, we only add the page in draft and nothing else?
For this iteration, yes. I think we could (as a future iteration on this), use the homepage template, and also automatically create a "blog" page that uses the blog listing template. Basically automatically shift their blog posts from the homepage and to a subpage if the theme has a static homepage.
/cc @iamtakashi on the above.
Otherwise clear out the home page content. As a bonus, if there's a homepage page template in the old theme, assign that to the homepage?
These are "un-edited" homepages?
I think it would be a new homepage that is blank, and the old one from a template-first theme would draft as above.
Interesting, I wouldn't have expected an empty homepage to be a better experience than the existing one in a new design
It doesn't look like WordPress allows us to set the blog page as the homepage (which kind of makes sense, that's what the show_on_front option is for.
We could set that one to posts, but that would disable the homepage updating until the user sets a new static homepage.
The confusion is coming from seeing the content of the theme you just moved away from, and thinking something has broken.
I updated D31499-code and its testing description.
It makes sense to show posts list when they switch to an old theme.
With D31499-code, if they switch to one of the template-first themes, they always get the demo site homepage regardless of what they have on the homepage (edited, un-edited, or posts list). Is this expected?
I'm not sure how I managed, but I ended up having homepage that is marked as draft on my site.

Otherwise clear out the home page content. As a bonus, if there’s a homepage page template in the old theme, assign that to the homepage?
I think this is what that might mean …
Example 1
I think Step 8 might be feel like you broke something?
It makes sense to show posts list when they switch to an old theme.
Let's do this for now, and hold off on any further homepage adjustments when switching to an older theme. We can iterate.
@obenland Two things on my mind:
@iamtakashi One other thing -- do the theme showcase instructions for the themes need to be updated to take into account these home page templates are activated automatically?
Is there any other theme documentation that needs updating?
Yeah, I think we need to update each documentation. But once we make one, we can copy and paste to all of them. The theme showcase page is the only documentation.
@obenland Redhill doesn't seem to work when I test this.
Deployed in r196263-wpcom