There is a welcome page in Discourse in which when the website is in private mode this message comes up:
An account is required. Please create an account or log in to continue.
I want to change the style of this page, add some photos and etc. Is there a way to use a designed static page for the welcome page? How can I change the design of this welcome page?
Ps. I am thinking to have something similar to this page in Quora:
From what I can understand, in “Admin, Customize, Text Content” just the “welcome message” can be changed.
My problem was that I could not figure out if there is any specific html/css/class… for “welcome page” so that I can change them in “Admin, Customize, CSS/HTML”.
Because I am going to include some photos, background and etc for the “welcome page” and so there should be a way to assign a new HTML to that specific page. Am I make sense?
Sure, if you press f12 in your browser you can look around for the appropriate CSS classes on the page. If we need to add another CSS class there let us know.
There is an .anon class that is added to the html element when there is a non-logged in user. I think that for sites that require login to read content, a non-logged in user can only access the login, FAQ, Terms of Service, and Privacy pages. They are most likely to only access the login page.
You can add a background image to it with something like this:
.anon {
background: url(http://wallpapercanyon.com/wp-content/uploads/2016/01/Background-Images-10.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
You can add html to the login_required.welcome_message. Any css classes that you add to that html will be stripped by the Discourse markdown parser. If you need to you can whitelist css classes with a plugin. I think a customized login page is a great idea
I think it’d be smart to get login_required.welcome_message its own CSS class. I tried to add my own classes to HTML inside of it, but they get stripped out.
How are people styling these login pages?
Mine has an ID of ember759 – is that specific only to the welcome page or is it also used elsewhere? And will this welcome/login page ever use a different ember ID? Perhaps I can use that for now.
We added divs without classes into our customized login_required.welcome_message and then are using selectors like this the following to target that text:
.anon .contents.body-page div div {
}
.anon .contents.body-page div div:nth-of-type(2) {
}
For the rest of the page, we’re using overrides on the following selectors:
Would it help @Berto and @mcwumbly if the the login_required.welcome_message was wrapped in a div itself? Beyond that, it doesn’t look like much can be added because the content of welcome_message is passed through a HTML sanitizer.
Instead of:
<div class="contents clearfix body-page">
<span id="ember772" class="ember-view">
</span>
<h2><a href="#welcome">Welcome to Dev Discourse</a></h2>
<p>An account is required. Please create an account or log in to continue.</p>
<button title="Log In" id="ember773" class="btn-primary login-button btn btn-icon-text ember-view">
<i class="fa fa-user d-icon d-icon-user"></i>
<span class="d-button-label">
Log In
</span>
</button>
</div>
You would have:
<div class="contents clearfix body-page">
<span id="ember772" class="ember-view">
</span>
<div class='login-required'>
<h2><a href="#welcome">Welcome to Dev Discourse</a></h2>
<p>An account is required. Please create an account or log in to continue.</p>
</div>
<button title="Log In" id="ember773" class="btn-primary login-button btn btn-icon-text ember-view">
<i class="fa fa-user d-icon d-icon-user"></i>
<span class="d-button-label">
Log In
</span>
</button>
</div>
So strong feelings either way personally, since we’ve got something in place that works. Just give us a heads up when this change is ready to roll out so we can make sure we make any necessary adjustments to the existing customization if necessary.