Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other How to "cover" the actual website title with another title?

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #161310
    arghman
    Participant

    Hello everyone.

    I’m a complete noob at anything CSS, and not very experienced at web design in general. I have a Japanese site that I’m running, but we have a problem. No one here in Japan searches in English, so the page title should be in Japanese. But when you actually arrive at the page, the Japanese page title looks heinous. So I would like the “real” page title to remain in Japanese, but would like to try to have an English title display in that spot when you actually are looking at the website.

    I’m using SquareSpace6, and here’s the website: http://www.LivingEnglishSapporo.com

    Any help is appreciated! I’m getting deperate here! Thanks in advance!

    #161331
    Paulie_D
    Member

    By “Title” do you mean <title>リビングイングリッシュ札幌</title> orthe h1 with the class of “.site-title`.

    #161335
    arghman
    Participant

    Sorry! By “title” I mean
    リビングイングリッシュ札幌
    !

    In English it’s “Living English Sapporo”, which is what I would like to “cover” the title with. But I still want the real “title” to be in Japanese so people can find it in search engines, etc. Does that make sense?

    #161336
    Paulie_D
    Member

    Hmmm…that’s not a CSS attribute / property so we’re in the wrong section.

    I’ll move this to ‘Other Discussions” but my thinking is that it’s not an easy process….even if it’s possible.

    You might consider adding a <meta> tag with a description.

    Here’s an example from Google at: https://support.google.com/webmasters/answer/35624?hl=en#1

    <meta name="Description" content="Author: A.N. Author, 
    Illustrator: P. Picture, Category: Books, Price: $17.99, 
    Length: 784 pages">
    
    #161341
    Gary Pickles
    Participant

    You could use jQuery

    <script type="text/javascript">
    $(document).ready(function() {
    
        $(this).attr("title", "sometitle");
    
    });
    </script>
    

    Found it here, I’ve test it on a local page

    http://stackoverflow.com/questions/180103/jquery-how-to-change-title-of-document-during-ready

    #161342
    Paulie_D
    Member

    I’m struggling to understand what effect that would have….probably because I don’t understand JS that well.

    If it will display the English version whilst leaving the underlying <meta> tag alone (and thus searchable in Japanese) then I think it would work.

    What I suspect it’s doing is actually switching the text completely…in which case one might as well just put the <meta> in English.

    #161343
    Gary Pickles
    Participant

    This jQuery allows the Japanese title for the search engine and when the page loads it changes to an English version. I’m not taking credit for writing this just a quick google found the answer, wasn’t sure if jQuery could edit the head of the document, turns out it can.

    #161359
    arghman
    Participant

    Thanks for the input guys!

    I’ve made the changes, and it seems like the title that appears on the status bar of the browser has properly changed to whatever I typed in the “sometitle” area. But the title that appears on the front of the website is still in Japanese. Any tips?

    #161363
    chrisburton
    Participant

    I would use pure Javascript for this. No reason to add an additional library for what Javascript can do as well.

    #161365
    arghman
    Participant

    chrisburton,
    Thanks for the input. Could you share with me how exactly I could do this in Javascript?

    #161366
    chrisburton
    Participant

    http://codepen.io/chrisburton/pen/vlpLz

    I’m curious if search engine bots will render this in English rather than Japanese as you have asked. I would look into that.

    #161367
    arghman
    Participant

    Wow, thanks!

    Now, where do I put it?! I’m not sure if I’m supposed to “edit code” then just do a Javascript entry and paste that in there, or if I’m supposed to edit the entire website’s header or what. Like I said, I’m a COMPLETE noob.

    #161368
    arghman
    Participant

    Actually, neither of those options works if I just cut and paste it in…!

    #161370
    chrisburton
    Participant

    You can place the javascript in a number of ways. Either in the head section between <script></script> tags or use a src="" in the script tag. When using the src attribute, you would have to create a file, paste the code in there and then save as to something like scripts.js or whatever you want to call it. Keep in mind you can put additional javascript code in that file too. It will keep your code clean.

    Solutions

    <script type="text/javascript">
    
        // change title
        document.getElementById("title").innerHTML="Living English Sapporo";
    
    </script>
    

    or

    <script type="text/javascript" src="/path/to/scripts.js"></script>
    
    #161372
    chrisburton
    Participant

    Ha. I see why it wasn’t working for you. Are you able to add attributes to your code (e.g. id="someting")?

Viewing 15 posts - 1 through 15 (of 19 total)
  • The forum ‘Other’ is closed to new topics and replies.