Reload page body when clicking a link in a custom header

(Coin-coin le Canapin) #1

Like many people, I’ve set up a custom header on top on my Discourse forum:

I wanted my top menu identical to my Wordpress site (I use WP-Discourse), this is why I kept the “Forum” menu item.

I would like this link to reload the forum body when clicked on, exactly when we click on the logo from the regular discourse header bar.

How can I achieve this?

(Joe) #2

Do you mean reload as in cause the whole page to reload - reload the entire app - or do you just want the link to take you to the homepage within the app?

(Coin-coin le Canapin) #3

This :slightly_smiling_face:

(Joe) #4

Try setting the href of the link to "/" Like so:

<a href="/">FORUM</a>

(Coin-coin le Canapin) #5

Hi, I already tried that as well as adding data-auto-route="true" with no success.

(Joe) #6

Try something like this:

<a href="/" class="home-link">FORUM</a>

<script type="text/discourse-plugin" version="0.8.20">
$(function() {
  $("a.home-link").click(function() {
    return false;

Where you give your link the classname home-link and run a tiny script when it’s clicked to force it to load within the app.

(Coin-coin le Canapin) #7

Hi, thanks for your reply.
It doesn’t work, and here’s the output code on the page source:

<script>Discourse._registerPluginCode('0.8.20', function (api) {

  $(function () {
    $("a.home-link").click(function () {
      return false;

(Joe) #8

I’m not sure what’s going on on your side, but I’m positive that that would work. Here’s a basic live example on theme creator:

(Coin-coin le Canapin) #9

Hi, I’ not sure what I did before but it is indeed working. Thank you very much!

(system) #10

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