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

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


solomonjki
Go to solution Solved by paul2009,

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
Link to post
  • Answers 15
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Popular Posts

$('h1.logo').html("<a href='/'>Jenna<br>Wortham</a>")  

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 vert

15 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 helping Squarespace users by building the features that Squarespace didn't include.
Explore our range of Squarespace Extensions, including the Wishlist, and Datepicker Extension or book a Squarespace Expert for 1:1 help. Note that links in my posts may be affiliate links.

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

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 helping Squarespace users by building the features that Squarespace didn't include.
Explore our range of Squarespace Extensions, including the Wishlist, and Datepicker Extension or book a Squarespace Expert for 1:1 help. Note that links in my posts may be affiliate links.

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
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
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
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
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?

Link to post
  • 0

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 post

Create an account or sign in to comment

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


×
×
  • Create New...