scullyio / scully

The Static Site Generator for Angular apps
https://scully.io/
MIT License
2.56k stars 257 forks source link

404.html does not include information about the site being created by scully #1531

Open BlindDespair opened 2 years ago

BlindDespair commented 2 years ago

🐞 Bug report

Description

We have certain pages that require authentication and therefore wish not to prerender them.

I am using 'ignored' router plugin on those pages and our CDN returns 404.html when trying to open them and it gets rendered on the client side by angular correctly, but an issue arises when you first open site on such page which is not prerendered and then you try navigating to a page that was prerendered using Angular navigation, in this case window['ScullyIO']='generated' is missing and TransferStateService does not fetch data.json but instead does the requests to our CMS which should not happen.

Navigating to non-prerendered pages from a prerendered page does not cause any issues and everything works correctly so I think that 404.html should contain window['ScullyIO']='generated' to make sure that TransferStateService behaves consistently regardless of which page users enters the site at.

🔬 Minimal Reproduction

Generate any angular application with scully and check contents of 404.html

💻Your Environment

Angular Version:


Angular CLI: 13.0.2
Node: 14.18.1
Package Manager: npm 7.24.0
OS: win32 x64

Angular: 13.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, material, platform-browser
... platform-browser-dynamic, router, service-worker
... youtube-player

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.2
@angular-devkit/build-angular   13.0.2
@angular-devkit/core            12.2.10
@angular-devkit/schematics      12.2.10
@angular/cli                    13.0.2
@schematics/angular             13.0.2
rxjs                            7.4.0
typescript                      4.4.4

Scully Version:


"@scullyio/ng-lib": "^2.0.2",
"@scullyio/scully": "^2.0.3",

aaronfrost commented 2 years ago

@BlindDespair do you have a sample site we can look at?

BlindDespair commented 2 years ago

@aaronfrost do you mean a repo or just a url to a deployed site. Sadly I do not have a sample site which demonstrates this deployed anywhere although we do have 1 production site with this. Although I pretty much summed it up in the description, generating any app with scully will produce 404.html and that should contain the info about it being pre-rendered by scully just like any page.html