• Highlight affiliate-links with spqr/assets and/or spqr/linker

Highlight affiliate-links with spqr/assets and/or spqr/linker

Affiliate links

Hello everybody,

as you may know: I am from Germany. And in Germany you can not do anything, without paying attention to the laws.

For example: If you created a little blog that contains affiliate links, you are not allowed to only link the external shop - you have to ensure that your visitors know that this is a sponsored link.

Well - I am not a lawyer, but this is the situation a lawyer explained to me.

Alright. So you need to create a little Sponsored badge or something like that, if your company (or even if you are a small startup without any employees) is located in Germany and you are using affiliate links, my article could be interesting for you.

How to start

At first, simply download spqr/assets. It's not difficult at all, but maybe check out the project page.

Now create a new asset - just like this:

Affiliate links 1 Affiliate links 2 Affiliate links 3 Affiliate links 4

Please make sure you selected:

  • Status: Published
  • Language: JavaScript
  • Type: Save Content To File
  • Filename: your-filename.js
  • Require: jQuery

Now add the following content:

$("a.afl").after(" <span class='uk-badge uk-badge-notification uk-badge-success uk-icon-shopping-cart'></span>");

This is an example, that adds:

<span class='uk-badge uk-badge-notification uk-badge-success uk-icon-shopping-cart'></span>` after a link with class `afl

You can replace the HTML part with your content.

Now make sure the asset is visible on all pages.

Affiliate links 5

Using spqr/linker (optional)

Of course you can spqr/linker to mask your affiliate links. You can add the class to every target - if you want to.

Affiliate links 6

Using the class in posts or pages

If you don't want to use spqr/linker, you can add the class manually.

Just add the class afl (or whatever you called it) to your links:

Affiliate links 7

The result

This is the result - looks fine, huh?

Affiliate links 8 Affiliate links 9


Please notice: I am not a lawyer. I can not guarantee that this is authorized by the law in force.

{{ message }}

{{ 'Comments are closed.' | trans }}

Wait a second!

Did you know that there's are great support channels for Pagekit? Visit us today and sign up for free using email or your GitHub-, Twitter-, Google- or Facebook-Account.

Latest blog posts

Latest comments

  • How to fork a theme

  • spqr/toc updated

  • spqr/toc updated

Like my work?

If you would like to support my work, you are invited to do so.