Skip to content

Add the ability to automatically set rel and target on external links#132

Open
blast007 wants to merge 1 commit intostakx-io:0.2from
blast007:feature/externallinks
Open

Add the ability to automatically set rel and target on external links#132
blast007 wants to merge 1 commit intostakx-io:0.2from
blast007:feature/externallinks

Conversation

@blast007
Copy link
Copy Markdown
Contributor

Summary

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed issues

Description

  • Added three configuration values under the 'links' section:
    • internalhosts: array of hostnames to ignore when deciding to add rel or target
    • externalrel: value of the rel attribute that should be added to external links
    • externaltarget: value of the target attribute that should be added to external links
  • For Markdown, inline links are processed based on the configuration values
  • For Twig, an 'a' function was added that takes href, text, and an array of attribute values and returns an HTML fragment with the 'a' tag. The configuration values are used to determine if rel or target should be added to external links. Additionally, it is possible to override the configuration by passing rel or target as an attribute, and passing an empty string for either will prevent the attribute from being added at all.

Check List

  • Added appropriate PhpDoc for modifications
  • Added unit test to ensure fix works as intended

* Added three configuration values under the 'links' section:
  - internalhosts: array of hostnames to ignore when deciding to add rel
or target
  - externalrel: value of the rel attribute that should be added to
external links
  - externaltarget: value of the target attribute that should be added
to external links
* For Markdown, inline links are processed based on the configuration
values
* For Twig, an 'a' function was added that takes href, text, and an
array of attribute values and returns an HTML fragment with the 'a' tag.
The configuration values are used to determine if rel or target should
be added to external links. Additionally, it is possible to override the
configuration by passing rel or target as an attribute, and passing an
empty string for either will prevent the attribute from being added at
all.
@allejo allejo self-requested a review September 5, 2023 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant