Recent searches


No recent searches

Hide custom guide links depending on language (location)

Answered


Posted Feb 10, 2022

We are releasing new language support for our app and help center. However, we have a customized Guide theme with direct links on the landing page of our Guide but it links to the English version and we don't want other languages having that options.

So we are trying to come up with some logic that says, if English then show links, if not then hide. 

That is the basic idea behind it.


1

5

5 comments

image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hi Michael Jenkins,

Using this code, you can hide your custom links from other languages and would be shown only in English local. You can use this idea in your script.js file.

 

Remove "LINK'S CLASS NAME" and add the link's class name, with a dot ( . ) because without dot ( . ) class-name won't work

e.g. $(" .language-link ")

or you can use tag-name without dot ( . ) 

e.g. $(" li > a ")

$(document).ready(function(){

var htmllang = document.documentElement.lang;

// Links are hidden for other languages
$("LINK'S CLASS NAME").hide();   

// If language is english
if (htmllang === "en-US"){

// Links would be shown now for english
$("LINK'S CLASS NAME").show();

}
});

 

Hope it helps you.

Thanks

 

 

1


I will give that a try, thank you for your help!

0


This worked. I had to be a bit creative but was able to get it to work. One thing to note, when I replaced the name I had initially forgot the . at the beginning which broke it. In case anyone else runs into an issue.

$("CLASS-NAME").show();
$(".CLASS-NAME").show();

1


image avatar

Nicole Saunders

Zendesk Community Manager

So glad you got things working, Angel Studios! Thanks for coming back and sharing your note as well. 

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

@Michael Jenkins, thanks for notifying me of this, now I updated the code for a dot ( . ) for others. And glad to hear that it's working for you.

1


Please sign in to leave a comment.

Didn't find what you're looking for?

New post