ampproject / ampproject/amphtml
Allow multiple link-rewriter configs
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Allow for the amp-link-rewriter to be configured for multiple input/output objects. This would allow for more customization for sites with multiple vendors.
Currently the amp-link-rewriter is expecting a singular config and throws error if missing output. If the rewriter is updated to take an array of configs, then the user would be able to add additional customization.
For example:
One link rewriter is generic and applies monetization to most anchor tags.
Another more specific rewriter to params to a specific link.
For the overlap it could be the first in the config array gets to rewrite the link.
### Alternatives Considered
Tried (with variable-sized container) for link rewriting, but it modifies the href after first click has happened.
### Additional Context
This is a copy of issue #23325
Contributor guide
Research direction
Start by locating the amp-link-rewriter implementation and its current singular input/output configuration handling. Define completion as accepting an array of configurations, supporting multiple vendors and applying the first matching rewriter when configurations overlap, while preserving the existing missing-output error behavior where applicable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100