I have a site, marked as the "home site" in viva connections. Since that time, the site also contains an "Announcements" library:

Since the time the Announcements-Library existed, Get-PnPSiteTemplate -out test.xml -Handlers PageContents -IncludeAllClientSidePages creates only empty templates, containing no pages at all.
My first quick finding was that
|
sitePagesLibrary = listCollection.Where(p => p.BaseTemplate == (int)ListTemplateType.WebPageLibrary).FirstOrDefault(); |
returns the Announcements library, instead of the Site Pages.