# Put a mailto link in the header

**URL:** <https://forums.realmacsoftware.com/t/put-a-mailto-link-in-the-header/33141>\
**Category:** RapidWeaver Classic\
**Created:** [May 30, 2020, 4:37am UTC](https://forums.realmacsoftware.com/t/put-a-mailto-link-in-the-header/33141 "2020-05-30T04:37:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayray](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/jayray/32/19130_2.png) [@jayray](https://forums.realmacsoftware.com/u/jayray)\
**Post date:** [May 30, 2020, 4:37am UTC](https://forums.realmacsoftware.com/t/put-a-mailto-link-in-the-header/33141/1 "2020-05-30T04:37:36Z")

</div>

I have been trying to create a Mailto link in the header navigation of my Future-themed site and I seemingly can’t do it using any built-in page types. Am I missing something? Please help.

---

<div class="post-metadata">

**Author:** ![willwood](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@willwood](https://forums.realmacsoftware.com/u/willwood)\
**Post date:** [May 30, 2020, 11:47am UTC](https://forums.realmacsoftware.com/t/put-a-mailto-link-in-the-header/33141/2 "2020-05-30T11:47:05Z")

</div>

Unfortunately RapidWeaver no longer allows you to provide a ‘mailto’ link against an offsite page type, otherwise this solution would’ve been perfect for your needs.

Stacks like [ActionHost](https://stacks4stacks.com/actionhost/) exist for manimulating links, but these will only work on a Stacks page type; not styled text, blog, markdown or anything like that.

The next solution is to use Javascript to change the link `href` value dynamically. Certainly not ideal, but it’s probably the best we have to work with.

So add an **offsite** page type to the website. Give the page a name like _“Contact Me”_ and then give it any random link of like [https://example.com/](https://example.com/) in the Page Inspector.

 ![27](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/8/2/82b0668cec48011097bbe38e8a9cf4fdff729a5a.jpeg)

Then copy and paste this code into **Settings \> Code \> Body** :

```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		var contactmelink = $('nav a').filter(function(index) { return $(this).text() === "Contact Me"; });
		$(contactmelink).attr("href", "mailto:example@example.com");
	});
</script>

```

Like this:

 ![06](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/8/8/88fad8cabfc2ad59b3d1edc399aa2050c9d4ca49.jpeg)

This uses jQuery Javascript. It uses the _filter_ method to look through all your links in the navigation menu. It looks for the link specially labeled _Contact Me_. It replaces the existing href value with the new one, in this case `mailto:example@example.com`

So hopefully even if you don’t fully understand the code, you can see the parts you might need to change.

Regretfully this solution requires pulling-in the entire jQuery Library from Google APIs. A pure Javascript ‘find and replace’ function would be lighter, but would likely be far more complicated.

If you used a better theme that already loads jQuery (for things like ExtraContent), then you could possibly omit this jQuery call and save yourself about 90KB of code.

As a side note - obfuscate your email address if you want to protect it from spam bots.

-Will.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/system/32/25301_2.png) [@system](https://forums.realmacsoftware.com/u/system)\
**Post date:** [June 29, 2020, 9:47pm UTC](https://forums.realmacsoftware.com/t/put-a-mailto-link-in-the-header/33141/3 "2020-06-29T21:47:06Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
