Skip to content

Repository files navigation

link later banner

Link Later

This is a small library to find and replace keywords in your html with linked keywords, it could also be easily adapted for different purposes, such as highlighting specific keywords.

Use cases might internal linking for SEO purposes, or affiliate linking.

Demo

What it does

In a nutshell it does this

What it does

Options

DescriptionType
scopeThe path to scope keyword replacement. For example if you only want to replace keywords under your products section the scope might be "/products"string
configSee ConfigConfig[]

Config

DescriptionType
keywordsComma separated list of keywordsstring
hrefThe href to link tostring
target?An optional value for the target attributestring
classes?Optional classes to be added to the linkstring
debug?Optionally add a yellow background to the created linksboolean
ignore?Optionally provide an array of html tags to ignore* if the text resides within themstring[]
  • the default list of ignored tags is: ["HEAD", "SCRIPT", "STYLE", "A", "BUTTON", "INPUT", "H1", "H2", "H3", "H4", "H5"]

How to use

importstartfrom"./link-later"importOptionfrom"./interfaces"/** * config */constoptions: Option[]=[{scope: "/",configs: [{keywords: "test,logistics solutions",href: "/my-logistical-solutions-link",target: "_blank",classes: "test-class",debug: true},],},{scope: "/",configs: [{keywords: "warehouse",href: "/my-warehousing-link",selector: ".rich-text",debug: true},{keywords: "Inland transportation",href: "/my-inland-services-link",selector: ".rich-text",debug: true},],}];start(options);

About

Replace keywords with linked keywords, with great specificity and options

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages