Mailtrain-org / mailtrain

Self hosted newsletter app
GNU General Public License v3.0
5.52k stars 691 forks source link

How do i show a blank page on the root path. #233

Closed ubergeekady closed 3 years ago

ubergeekady commented 7 years ago

I want users to see some custom text/html at the root of the domain. Not mailtrain homepage.

niyyie commented 7 years ago

Same here! I just setup and tried the script today. Awesome. The homepage is my only issue for now.

witzig commented 7 years ago

Showing a blank or custom homepage isn't currently possible out of the box, and it might also be a conflict of interest to implement such a feature (once the React client is done). Depends on Andris.

PS. If you feel adventurous, perhaps this hackish custom script could work for you (too). You'd need to add it in your config file. Disclaimer: It will break once the markup changes. Use at your own risk.

quinncomendant commented 7 years ago

Here's a simpler way to change the content of the Mailtrain home page. Just enter some JS into the Frontpage shout out field of the Mailtrain settings that does some DOM replacements. It is required to include the jquery script first so it is available when the script executes. Like @witzig's script, it will also stop working when the markup of the home page changes.

<script src="/javascript/jquery-2.2.1.min.js"></script>
<script>
(function ($) {
    $(document).ready(function() {
        $('.jumbotron h1').text('Company Newsletter').after('<a href="/subscription/XXXXXX">Subscribe here</a> for our newsletter blah blah blah.');
        $('.navbar-brand, body:not(.logged-in) .navbar-nav:not(.navbar-right), .jumbotron p, body > .container, footer').remove();
    });
}(jQuery));
</script>

You can see how it looks on our site.

triggeroni commented 5 years ago

@quinncomendant that was extremely useful, worked like a charm for us. Thanks!

dafky2000 commented 4 years ago

Just a small improvement upon @quinncomendant solution using mostly CSS and modifying the text if javascript is enabled. This eliminates the flashing of the original content and optionally restores the homepage once logged in. If you never want to show the original root page, remove :not(.logged-in) throughout.

<style>
  body:not(.logged-in) .navbar-header { display: none }
  body:not(.logged-in) .navbar-nav:not(.navbar-right) { display: none }
  body:not(.logged-in)>.jumbotron { display: none }
  body:not(.logged-in)>.jumbotron>.container>p { display: none }
  body:not(.logged-in)>.container { display: none }
  body:not(.logged-in) footer { display: none }
</style>

<script src="/javascript/jquery-2.2.1.min.js"></script>
<script>
(function ($) {
    $(document).ready(function() {
        $('body:not(.logged-in)>.jumbotron h1')
          .text('Company Newsletter')
          .after('<a href="/subscription/XXXXXX">Subscribe here</a> for our newsletter blah blah blah.');
        $('body:not(.logged-in)>.jumbotron').show();
    });
}(jQuery));
</script>