Module: HrefTag

Defined in:
href.rb

Overview

Generates an href. Note that the url should not be enclosed in quotes.

If the link starts with 'http' or match is specified: The link will open in a new tab or window The link will include rel=nofollow for SEO purposes.

To suppress the nofollow attribute, preface the link with the word follow. To suppress the target attribute, preface the link with the word notarget.

The match option looks through the pages collection for a URL with containing the provided substring. Match implies follow and notarget.

If a section called plugin-vars exists then its name/value pairs are available for substitution. plugin-vars: django-github: 'https://github.com/django/django/blob/3.1.7' django-oscar-github: 'https://github.com/django-oscar/django-oscar/blob/3.0.2'

href {{django-github}/django/core/management/init.py#L398-L401 django.core.management.execute_from_command_line %}

Examples:

General form

{% href [follow] [notarget] [match] url text to display %}

Generates nofollow and target attributes.

{% href https://mslinn.com The Awesome %}

Does not generate nofollow or target attributes.

{% href follow notarget https://mslinn.com The Awesome %}

Does not generate nofollow attribute.

{% href follow https://mslinn.com The Awesome %}

Does not generate target attribute.

{% href notarget https://mslinn.com The Awesome %}

Matches page with URL containing abc.

{% href match abc The Awesome %}

Matches page with URL containing abc.

{% href match abc.html#tag The Awesome %}

Substitute name/value pair for the django-github variable:

Author:

  • Copyright 2020 Michael Slinn

License:

  • SPDX-License-Identifier: Apache-2.0

Defined Under Namespace

Classes: ExternalHref