https://github.com/statamic/highlight
Highlight content on your page.
https://github.com/statamic/highlight
Last synced: 3 months ago
JSON representation
Highlight content on your page.
- Host: GitHub
- URL: https://github.com/statamic/highlight
- Owner: statamic
- Created: 2014-03-20T13:37:25.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-04-27T13:54:00.000Z (about 9 years ago)
- Last Synced: 2025-03-22T04:41:27.399Z (3 months ago)
- Language: PHP
- Size: 1.95 KB
- Stars: 5
- Watchers: 10
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Highlight 
Highlight words on the current page based on a variable in the URL.
## Usage
This is a modifier that will work with any text string.
```
{{ content|highlight }}
```## Installing & Setup
Highlight requires Statamic v1.7.0 or later.
1. Drag `_add-ons/highlight` into your site's `_add-ons` folder
2. Drag `_config/add-ons/highlight` into your site's `_config/add-ons` folder
3. Configure `_config/add-ons/highlight/highlight.yaml` as desired## Settings
- `get_variable` is the variable to look for in the URL, `mark` by default; if more than one word is specified (separated by spaces), each will be marked individually
- `wrapping_element_start` is what will be placed immediately before each match
- `wrapping_element_end` is what will be placed immediately after each match## Integrating with Bloodhound
You'll need to update your result links to have your `get_variable` and the given `{{ _query }}` appended to each `{{ url }}` within your `{{ bloodhound:search }}` tags, like this:
```
{{ url }}?mark={{ _query }}
```This will pass the made query along in the `mark` variable.
You can configure `get_variable` to look for anything you want.
If you change that, be sure to use the correct variable in your URLs.