# Absolute URLs in decorateWidget API being rewritten

**URL:** <https://meta.discourse.org/t/absolute-urls-in-decoratewidget-api-being-rewritten/54337>\
**Category:** Support\
**Created:** [December 16, 2016, 6:32am UTC](https://meta.discourse.org/t/absolute-urls-in-decoratewidget-api-being-rewritten/54337 "2016-12-16T06:32:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanielMarquard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielmarquard/32/74010_2.png) [@DanielMarquard](https://meta.discourse.org/u/DanielMarquard)\
**Post date:** [December 16, 2016, 6:32am UTC](https://meta.discourse.org/t/absolute-urls-in-decoratewidget-api-being-rewritten/54337/1 "2016-12-16T06:32:10Z")

</div>

This seems like it could be a subdirectory bug. With the code below, a button is generated in the header to the specifications, including in the HTML, but rather than being taken to `/donate` when clicked, users are instead taken to `/community/donate`.

```javascript
api.decorateWidget('header-buttons:after', helper => {
    return helper.attach('link', {
        className: 'btn-primary btn-small login-button donate-button',
        icon: 'paypal',
        rawLabel: "Donate",
        href: "https://critcola.com/donate"
    });
});

```

---

<div class="post-metadata">

**Author:** ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)\
**Post date:** [December 19, 2016, 7:38pm UTC](https://meta.discourse.org/t/absolute-urls-in-decoratewidget-api-being-rewritten/54337/2 "2016-12-19T19:38:39Z")

</div>

The `link` widget is specifically meant to route within the discourse app, so in this case it thinks `/donate` is a path within the forum. Instead you could just make your link manually like this:

```javascript
api.decorateWidget('header-buttons:after', helper => {
    return helper.h('a', {
        className: 'btn-primary btn-small login-button donate-button',
        attributes: { href: 'https://critcola.com/donate', target: '_blank' },
    }, [helper.h('i.fa.fa-paypal'), ' Donate'])
});

```

---

<div class="post-metadata">

**Author:** ![DanielMarquard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielmarquard/32/74010_2.png) [@DanielMarquard](https://meta.discourse.org/u/DanielMarquard)\
**Post date:** [December 21, 2016, 10:33am UTC](https://meta.discourse.org/t/absolute-urls-in-decoratewidget-api-being-rewritten/54337/3 "2016-12-21T10:33:48Z")

</div>

Good to know. Thanks!

---

<div class="post-metadata">

**Author:** ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)\
**Post date:** [December 28, 2016, 7:49pm UTC](https://meta.discourse.org/t/absolute-urls-in-decoratewidget-api-being-rewritten/54337/4 "2016-12-28T19:49:16Z")

</div>


