This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { WidgetRegistry, initRegistry, defaultWidgetRegistry } from '@progress/sitefinity-nextjs-sdk'; | |
| import { myCustomFiltering } from './components/custom-filters/my-custom-filtering'; | |
| const customWidgetRegistry: WidgetRegistry = { | |
| widgets: { | |
| // your custom widgets here | |
| }, | |
| filters: [ | |
| myCustomFiltering | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use client'; | |
| import { WidgetMetadata } from '@progress/sitefinity-nextjs-sdk'; | |
| import { GetWidgetsArgs } from '@progress/sitefinity-nextjs-sdk'; | |
| export async function myCustomFiltering(widgetMetadata: WidgetMetadata, args: GetWidgetsArgs): Promise<boolean> { | |
| // Your filtering logic here | |
| // Return true to show the widget, false to hide it | |
| // Example: Hide a specific widget based on its name | |
| if (widgetMetadata.designerMetadata?.Name === 'MyCustomWidget') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { WidgetRegistry, initRegistry, defaultWidgetRegistry } from '@progress/sitefinity-nextjs-sdk'; | |
| const customWidgetRegistry: WidgetRegistry = { | |
| widgets: { | |
| // ... your custom widgets | |
| }, | |
| filters: [ | |
| // ... your custom filters | |
| ] | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ScriptInjectorBodyTop, ScriptInjectorBodyBottom } from '../widgets/script/script-injector'; | |
| export function SitefinityTemplate({ widgets, requestContext }: { | |
| widgets: { [key: string]: ReactNode[] }; | |
| requestContext: RequestContext; | |
| }): JSX.Element { | |
| return ( | |
| <> | |
| <ScriptInjectorBodyTop requestContext={requestContext} /> | |
| <header data-sfcontainer="Header"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
| })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
| ga('create', 'UA-XXXXX-Y', 'auto'); | |
| ga('send', 'pageview'); | |
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { WidgetRegistry, initRegistry, defaultWidgetRegistry } from '@progress/sitefinity-nextjs-sdk'; | |
| import { Script } from './widgets/script/script'; | |
| import { ScriptEntity } from './widgets/script/script.entity'; | |
| const customWidgetRegistry: WidgetRegistry = { | |
| widgets: { | |
| 'Script': { | |
| componentType: Script, | |
| entity: ScriptEntity, | |
| ssr: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const ScriptLocation = { | |
| Inline: 'Inline', | |
| BodyTop: 'BodyTop', | |
| BodyBottom: 'BodyBottom' | |
| } as const; | |
| export type ScriptLocationType = typeof ScriptLocation[keyof typeof ScriptLocation]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Choice, ContentSection, ContentSectionTitles, DataType, DefaultValue, Description, DisplayName, KnownFieldTypes, WidgetEntity } from '@progress/sitefinity-widget-designers-sdk'; | |
| import { ScriptLocation } from './script-location'; | |
| @WidgetEntity('Script', 'Script') | |
| export class ScriptEntity { | |
| @ContentSection(ContentSectionTitles.LabelsAndMessages, 0) | |
| @DisplayName('Script location') | |
| @Description('Select where the script should be placed on the page') | |
| @Choice([ | |
| { Title: 'Inline', Name: ScriptLocation.Inline, Value: ScriptLocation.Inline }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import 'server-only'; | |
| import { WidgetContext, htmlAttributes } from '@progress/sitefinity-nextjs-sdk'; | |
| import { ScriptEntity } from './script.entity'; | |
| import { ScriptLocation } from './script-location'; | |
| export function Script(props: WidgetContext<ScriptEntity>) { | |
| const { model } = props; | |
| const entity = model.Properties; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { WidgetModel } from '@progress/sitefinity-nextjs-sdk'; | |
| import { RequestContext } from '@progress/sitefinity-nextjs-sdk'; | |
| import { ScriptLocation, ScriptLocationType } from './script-location'; | |
| interface ScriptInjectorProps { | |
| requestContext: RequestContext; | |
| } | |
| // Helper function to flatten nested widget hierarchy |
NewerOlder