Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
solomonjki

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

Question

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

Share this post


Link to post

13 answers to this question

Recommended Posts

  • 0

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.


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 1
$('h1.logo').html("<a href='/'>Jenna<br>Wortham</a>")

 


Free Squarespace 7.1 Anchor Link and Accordion Plugins available here!

If I replied to one of your questions with code, it was either CSS or jQuery.

To add CSS, go to Design -> Custom CSS

jQuery needs some additional steps. Head here: https://code.jquery.com/ and click on minified, under jQuery 3.x and copy that code into Squarespace.

After you put that code into the code injection section in Squarespace, you can add the code I supplied. The code from me will need <script> added before it and </script> added after it (only for jQuery).

There are two places that you can add the code, one is site wide (adds to all pages). Settings -> Advanced -> Code Injection

The other is for a specific page (adds to one page only). Pages -> Gear Icon next to the page -> Advanced

Share this post


Link to post
  • 0

Hi Paul2009,

 

Tried it out but unfortunately without any result. I added it to the header instead of the footer (as you suggested) as it is for my site title

 

T

Share this post


Link to post
  • 0

@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.


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 0
Posted (edited)

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!

Edited by barista_boy

Share this post


Link to post
  • 0
Posted (edited)

Hi Paul2009,

I was looking to achieve a line break in my site title, but I know the above work would have to be customized to my specific template. How would I got about achieving this?

thank you very much!

Edited by lizayala1211

Share this post


Link to post
  • 0

Can you post a screen shot of what it looks like now and what needs to be moved?


Free Squarespace 7.1 Anchor Link and Accordion Plugins available here!

If I replied to one of your questions with code, it was either CSS or jQuery.

To add CSS, go to Design -> Custom CSS

jQuery needs some additional steps. Head here: https://code.jquery.com/ and click on minified, under jQuery 3.x and copy that code into Squarespace.

After you put that code into the code injection section in Squarespace, you can add the code I supplied. The code from me will need <script> added before it and </script> added after it (only for jQuery).

There are two places that you can add the code, one is site wide (adds to all pages). Settings -> Advanced -> Code Injection

The other is for a specific page (adds to one page only). Pages -> Gear Icon next to the page -> Advanced

Share this post


Link to post
  • 0
Posted (edited)

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

Share this post


Link to post
  • 0
Posted (edited)

Thank you for the help! It seems to work when the percentage us under 30%, I currently have it at 28%. But ideally, I would want the site title to stay the same px size. 

Edited by lizayala1211

Share this post


Link to post
  • 0

So, we can do this, but I need to know what you want the menu to do when it becomes too long for the available space.

Do you want it to go above the logo, or do you want it to start stacking vertically on the right?


Free Squarespace 7.1 Anchor Link and Accordion Plugins available here!

If I replied to one of your questions with code, it was either CSS or jQuery.

To add CSS, go to Design -> Custom CSS

jQuery needs some additional steps. Head here: https://code.jquery.com/ and click on minified, under jQuery 3.x and copy that code into Squarespace.

After you put that code into the code injection section in Squarespace, you can add the code I supplied. The code from me will need <script> added before it and </script> added after it (only for jQuery).

There are two places that you can add the code, one is site wide (adds to all pages). Settings -> Advanced -> Code Injection

The other is for a specific page (adds to one page only). Pages -> Gear Icon next to the page -> Advanced

Share this post


Link to post

Create an account or sign in to comment

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


×
×
  • Create New...