https://github.com/psmb/psmb.term
Replace occurrences of terms with links to them
https://github.com/psmb/psmb.term
neoscms
Last synced: 4 months ago
JSON representation
Replace occurrences of terms with links to them
- Host: GitHub
- URL: https://github.com/psmb/psmb.term
- Owner: psmb
- License: mit
- Created: 2016-05-12T12:27:47.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-24T21:00:00.000Z (about 8 years ago)
- Last Synced: 2025-01-03T22:48:07.628Z (6 months ago)
- Topics: neoscms
- Language: PHP
- Size: 30.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
This package will help you to automatically link all occurrences of
your terms within given text. Great for SEO and stuff.## Usage
### 1. Install the package
```
composer require psmb/term
```### 2. Add `Psmb.Term:TermMixin` to the nodetypes that you want to use as terms
```
'Your.NodeTypes:Tag':
superTypes:
'Psmb.Term:TermMixin': true
```### 3. Process any text you want with `Psmb.Term:ReplaceTerms` TS object
E.g. if you want terms to be replaced in all Text nodes:
```
prototype(Neos.Neos.NodeTypes:Text) {
[email protected] = Psmb.Term:ReplaceTerms
}
```Processor has option `absolute` which would force creation of absolute uris.
### 4. Create term nodes
You may also fill-in their `replaceVariants` property for alternative spelling
variants, separated by comma, supporting regexp, "+" expands into "\w*?".
E.g. `duck+` matches `duck`, `ducks`, `ducklings` etc.