nextbox / neos-urlshortener
NextBox Neos url shortener
Installs: 1 399
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:neos-plugin
Requires
- neos/neos: *
README
This package provides an url shortening for Neos.
Configuration
Default
Add the following mixin to your document NodeType: NextBox.Neos.UrlShortener:Identifier
Create a new Routes.yaml
with the following content:
# Configuration/Routes.yaml - name: 'Redirect for default' uriPattern: 'short/{shortIdentifier}' # replace `short` with your preferences defaults: '@package': 'NextBox.Neos.UrlShortener' '@controller': 'Redirect' '@action': 'redirectToPage' 'shortType': 'default' # if you are using the default Mixin then do not change this line appendExceedingArguments: false httpMethods: ['GET']
Extensibility
If you want to have different path names for url shortening than you can create your own configuration.
- Create a Mixin or use an existing NodeType:
# Configuration/NodeTypes.UrlIdentifier.yaml 'Foo.Bar:ProductIdentifier': # change with your name abstract: true superTypes: 'NextBox.Neos.UrlShortener:BaseIdentifier': true properties: productId: # you can change the property name individually type: string ui: label: 'URL Short Identifier' reloadIfChanged: true inspector: group: 'document'
- Create the setting
# Configuration/Settings.yaml NextBox: Neos: UrlShortener: shortTypes: 'product': # change the name of the type nodeType: 'Foo.Bar:ProductIdentifier' # change the NodeType name to the new created Mixin or to the existing NodeType property: 'productId' # the property name of the identification - this field must be globally unique for the used Mixin rootNodePath: '/sites/siteOne' # optional, the base path for the Flow Query to search for the nodes
- Create a route:
# Configuration/Routes.yaml - name: 'Redirect for product' uriPattern: 'product/{shortIdentifier}' # do not change `shortIdentifier`, just change the path for your preferences defaults: '@package': 'NextBox.Neos.UrlShortener' '@controller': 'Redirect' '@action': 'redirectToPage' 'shortType': 'product' # change this to the name of the type from the settings appendExceedingArguments: false httpMethods: ['GET']