-
Notifications
You must be signed in to change notification settings - Fork 4
Anchor Links
Sarah Carney edited this page Oct 1, 2020
·
3 revisions
admin/config/content/ckeditor
- Edit the WYSIWYG profile
- Under Editor Appearance, add the flag icon to the current toolbar, preferably with the other link icons.
admin/config/content/formats/wysiwyg
- WYSIWYG Filter tab
- We need to adjust the HTML attributes allowed on
a
elements: allowa
without anhref
, and allow ana
to have anid
. - Change
a[!href|target|title],
toa[href|target|title|id|name],
A snipped of CSS in a custom styling module should handle this.
/* ------------------- */
/* ANCHOR LINK FIX
/* ------------------- */
html {
scroll-padding-top: 100px;
}
Create an anchor
- Place the cursor at the end of the line where you want the anchor
- Click the anchor icon in the WYSIWYG toolbar. Looks like a little flag.
- Use a unique id that would make sense if you saw it in a url
Make a link to the anchor
- Make a link as usual, but choose 'Link to anchor in text' for Link Type
- Choose an anchor from the list.