Need help in customizing header in latest discourse verison


(Akshat) #1

Hi,

I have been using discourse version 1.6 for past few months in production, we had customized the headers of discourse using the HTML/CSS customizations by applying the HTML changes on header hbs template.

Recently, I have been facing a lot of spams and wanted to install Akismet plugin for this, but unfortunately that requires rebuilding discourse and after upgrade I am loosing all the headers.

The same customization which were working in 1.6 are no more working.

I urgently need help on how to customize the latest version of discourse, or any other way I can install a Akismet plugin without rebuilding docker.

Thanks
Akshat


(RĂ©gis Hanol) #2

Without knowing the issues you are encountering, we can’t help you.

There is no other way to install a plugin. You have to rebuild the container.


(Akshat) #3

Please let me know what more information is needed, I shall provide the same.
I am trying to use the same customization I was using in the older version, but they are not reflecting, I at least don’t see any error on the UI, if there is anyplace where I can check do let me know.


(RĂ©gis Hanol) #4

Are there any errors in the console of your browser?
Are there any errors that might be related to customization in “your.discourse/logs”?


(Akshat) #5

no errors.
Is there a documentation you can share for adding customized headers in discourse using hbs, or maybe if we can connect on a live session and you can help me fix this.
Appreciate you help !!


(RĂ©gis Hanol) #6

Can you share the customization you’ve done?


(Akshat) #7

Here is the customization done in the head tag of the Header Customization.
http://pastebin.com/iGZJYy6N


(RĂ©gis Hanol) #8

Wow that’s a huge file :open_mouth: Can you extract the parts that are specific to :discourse: and don’t work?


(Mittineague) #9

Sounds like two issues.

  • You hacked / replaced the Core template file instead of using a plugin to over-ride it. In essence creating a non-supported fork.
  • Some of what your custom code is targeting / calling is no longer available.

Yes. Sorry but ~1.5 K lines is more than I have the patience to sift through.

Assuming you have again replaced the Core template, are you sure you aren’t getting any error messages in a log or the console?


(Akshat) #10

No, I don’t see any errors.
Yes, I am not using any plugins , I am relying on the customization feature to override add.
I am more than happy to change the implementation, please help me with what is the right way to add customized headers.


(Mittineague) #11

You added all that in Admin -> Customize ?!

That’s better than directly messing with Core files and works (though personally for that much I think a plugin would be easier to work with)

Anyway, by using dev tools inspect, I can see your code is there, added into the Discourse generated mark-up.

So the question is what do you mean by “loosing all the headers”?

If a page element, got a screen shot of where they should be?


(Mittineague) #12

You must not have understood what I was referring to.

I meant the browser’s web developer tools (eg. F12)

I see these at your site, but not here

Uncaught TypeError: Cannot read property 'reopen' of undefined	
yourdost.com/:166

Using `LoadMore` as a view mixin is deprecated. Use `{{load-more}}` instead
_application-1d09187….js:8934

Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
1949109082-idpiframe.js:6 

(Akshat) #13

I am new to this, can you help me debugging this, I can give you access to the site or we can connect on a live session.
Really appreciate your help on this, I am not able to figure out what to do.


(Akshat) #14

This is how it is in the old version and what I want

But, this is how I see it once I apply the customization on the never version.


(Mittineague) #15

Hmmm, odd.

You’re referring to what i’d call “top navigation links”

But using Windows 10 Vivaldi this is what I currently see.


(Akshat) #16

You are using a wrong link.
try accessing staging-forum.yourdost.com.
This is the one which has top navigation links missing.


(Mittineague) #17

Ah, that’s explains some.

I am getting an error message in the console

Uncaught TypeError: Cannot read property 'reopen' of undefined

Discourse.TopicListItemView.reopen({
showCategory: function(){
return !this.get('controller.hideCategory') &&
this.get('topic.creator') &&
this.get('topic.category.name') !== 'uncategorized';
}.property()
});

I don’t see any “TopicListItemView” in your custom code.

Any idea as to why it’s undefined?

Have you tried temporarily uninstalling third party plugins?


(cpradio) #18

Yes, it was likely changed as part of a refactor several months ago.

For menu links, take a look at