Jump to content

How do I create a line break in my site title?

Go to solution Solved by paul2009,

Recommended Posts

Link to my website
I noticed when updating my site today that using <.br.> (minus the periods) has totally stopped working in my site title as a line break and simply displays as normal text. I've replaced it with a | for now. It was never a good solution because it showed up in previews as text as well but at least it worked on the site.So, how do I create a line break now if this code is no longer accepted?

Edited by solomonjki
Initial Revision
Link to comment
  • Solution

In early September 2018, Squarespace removed the option to add HTML markup to titles. It was something that they never directly supported but that they ‘allowed’. They took a decision to improve the security model by following best practice and they no longer render the code. Here's a workaround using some JavaScript. Add it to the site's code injection footer (in Settings > Advanced > Code Injection > Footer:


<!--- Wrap site title on two lines (c) sf.digital --->
<script>
window.Squarespace.onInitialize(Y, () => {
 var title = document.querySelector('.site-title a');
   title.innerHTML = title.innerText.replace('|', '<br>');
});  
</script>

Let me know how you get on.

-Paul

Squarespace Expert & Professional Developer

Contributors to this forum voluntarily give their time to help you. If we correctly answer your question, please accept the answer by clicking Accept below it (you'll see it when you're logged on). If an answer doesn't help, feel free to ask for more help or wait for other forum users to add their comments and/or answers.

Whenever an accepted answer helps you, please vote it up using the up arrow on the right. This helps other forum users by giving them confidence in an answer.

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

Link to comment
  • 7 months later...

@Thomasnt The code was specific to the user's template so it may need to be adapted for your site. It will help us if you include a working link to your site so that we can see the settings. If your site isn't live yet, please set a site password and tell us what it is, so that we can view it.

 

4 minutes ago, Thomasnt said:

I added it to the header instead of the footer (as you suggested) as it is for my site title

The code location is not determined by the item that you want to affect. It should be installed in the code injection footer so that it loads after the site has finished loading.

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

Link to comment
  • 3 weeks later...
15 hours ago, barista_boy said:

I tried this with Montauk and it did not work. Can you please tell me what I need to change the 'site-title a' to, so that it will work>

Thanks!

.logo a

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 1 month later...

Of course! The below screenshot is what the page currently looks like. I'm attempting to move decrease the margins on both the right and left sides so that the navigation bar sits at the top right side of the page next to the scaled site title. I was thinking of re-arranging the CSS so the navigation bar comes before the site title? Not sure how to achieve this best!

 

Edited by lizayala1211
Link to comment
  • 3 months later...
  • 1 month later...

Ain't it just the <br> tag that you need for this?  As it does not have an end tagYou can also add additional lines between paragraphs by using the <br> tags. Maybe i am not right as i don't really know a lot of things about this. However, i guess you just have to add this tag into the HTML, and then it must work out. I am really surprised, how i am working to set my own website, however i don't really know anything about these simple things. We are even working with https://amasty.com/page-builder-for-magento-2.html to set the ecommerce platform for it.

Edited by Feliciak
Link to comment
  • 2 months later...
On 1/27/2021 at 5:11 PM, Kmel said:

Can someone help out with mine? 
Need the “Creative + Design Director” line to be underneath my name.

https://ellipsoid-spinach-4f36.squarespace.com/config/pages

Hi. What is access password?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 10 months later...
On 12/8/2021 at 8:52 PM, skeebodelta said:

Site URL: https://www.richardsaltermusic.com/

Hi all!

 

I wanted to have my name & job description at the very top of my site header, which I've done.

 

However, I had to find a workaround of taking a screenshot of the text then uploading it as a logo. As Mac screenshots are not that HQ, I can see a slight decrease in quality compared to the text on the rest of the site. I'd like to be able to replace this with actual text, so that it's better quality. I'm also told that from an SEO perspective, it's going to be better to have text there instead.

Anybody know of a way to do this please?

 

Thanks in advance!

 

x

You can add a Site Title text, then we can give the code to add a subtitle under title

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
22 hours ago, skeebodelta said:

Thanks for your reply @tuanphan!

I just added the text,  but would like the font sizes of "Richard Salter Record Producer - Composer" to be the same as what's attached.

 

Thanks! x11968633_ScreenShot2021-12-11at10_34_56.thumb.png.8c0324da87e19778144666bf6feb5654.png

Add to Design > Custom CSS

a#site-title:after {
    content: "Record Producer";
    display: block;
    font-size: 26px;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
On 12/12/2021 at 5:56 PM, skeebodelta said:

@tuanphan

 

This is really great, thanks!

Could you give me a code so I can have control of font size on the top text "Richard Salter" please?

Thanks in advance! x

 

 

Use this CSS

a#site-title {
    font-size: 46px;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.