ScullyContent Component
Thescully-content component is responsible for loading and rendering the static HTML content generated by Scully during the build process.
Overview
This component works by:- Loading the pre-rendered HTML from Scully’s static generation
- Injecting it into the DOM
- Upgrading internal links to use Angular Router for SPA navigation
- Handling route changes to load new content dynamically
Installation
Import theScullyLibModule in your Angular module:
Basic Usage
Add the<scully-content> component to your template where you want the static content to appear:
Input Properties
localLinksOnly
<scully-content> element are upgraded to use Angular Router. When disabled (default), all links in the document are upgraded.
Default: false
Examples:
How It Works
Content Loading
The component loads content in different ways depending on the context: 1. Initial Static Rendering (during Scully build):[currentRoute]/index.html to get the pre-rendered content.
3. In Development Mode:
If the production file isn’t found, falls back to Scully’s dev server at http://localhost:1668.
Link Upgrading
The component automatically upgrades<a href> links to use Angular Router:
scully-routes.json file are upgraded. External links remain unchanged.
Advanced Usage
Custom Styling
Style the content using CSS selectors:With Loading State
With Metadata Display
Handling Multiple Content Sections
Important Notes
Does Not Work Inside *ngIf
The component will not work if placed inside an*ngIf directive:
Content Markers
Scully wraps content with HTML comments:Error Handling
The component displays error messages when content cannot be loaded:Configuration
Configure the component behavior throughScullyLibModule.forRoot():
Configuration Options
Component Lifecycle
- Constructor: Service initialization
- ngOnInit: Content loading begins
- handlePage: Fetches and injects static HTML
- upgradeToRoutelink: Upgrades links to use Router
- routeUpdates$: Monitors navigation for content updates
- ngOnDestroy: Cleanup and unsubscribe

