Add text/ads on first post

(DjCyry) #1

Hello ,

How can i add a text or ad in the first post , at the end ?
Is there a css modification or something ? thanks


you can edite the show.html.erb


and copy this code on optional line

<a target="_blank" href=""><img src="/ads/appget4.gif" width="468" height="60" alt="banner" title="vbiran"></a>

like this

(DjCyry) #3

Where can i find : app/views/topics/show.html.erb in ftp server please , i use ubuntu , thanks


I think,I’m not sure

cd /var/www/discourse

(DjCyry) #5

that is on centos i think …on ubuntu not :slight_smile:


you must edite discourse core file


and rebuild it
###Im just tested in local server , i’m not tested on real server

(DjCyry) #7

I understand but , where can i fint the “app” folder ?


in the discourse surce file

(DjCyry) #9

Anyone can help me , please ?¿


you can eidte discours core file and rebuile it

(DjCyry) #11

Any how to here for this ? thx


first backup your site
and cd /var/discourse/app/views/topics/
eidte it with nano or vim

nano show.html.erb

nad set your cods ,save it

cd /var/discourse 
./launcher rebuild app

you first test in local


@Qasem_h No. If he has installed it via docker (which you have to assume unless he specifies otherwise) he has to ./launcher ssh app first.

@djcyry To edit those files you must first enter the docker container with the ./launcher ssh app command. Then you can browse to the file he said and make the changes you want. These will probably get overwritten though if you upgrade or you rebuild discourse.

Basically, don’t do what he said.


yesy he can do ./launcher ssh app and cd /var/www/discourse for edite

(Mittineague) #15

No “probably”. They will be over-written. If you go this route be prepared to do it often.

Have you seen

(Jens Maier) #16

It’s ./launcher enter app./launcher ssh is deprecated.

@djcyry: Don’t edit the .erb files. These produce static HTML that will only be visible to users with disabled JavaScript. Instead, override the handlebars template for posts. The original template can be found in app/assets/javascripts/discourse/templates/post.hbs. You can override this template in a simple site customization: simply put this in the header customization:

<script type="text/x-handlebars" data-template-name="post">
<!-- paste original template here and modify -->

(Mittineague) #17

My preferred way is via a plugin eg.


register_asset "javascripts/discourse/templates/connectors/poster-avatar-bottom/poster-avatar-bottom.hbs"


{{#if topic }}
		NOT Admin

Then I’ve hacked the Core post.hbs file adding a plugin-outlet like so

    <div class='topic-avatar'>
      <div class="contents">
        {{#unboundIf userDeleted}}
          <i class="fa fa-trash-o deleted-user-avatar"></i>
          {{raw "post/poster-avatar" post=this classNames="main-avatar"}}
        {{plugin-outlet "poster-avatar-bottom"}}

This was only a learning exercise for me. If it was something I was serious about pursuing I would add a config folder with files to create Admin UI options and ask that the plugin-outlet be placed into the Core template file.