Inserting and editing links in articles

Return to top

52 Comments

  • Ryan McGrew
    Zendesk Product Manager

    Hey All,

    I've escalated this to a ticket for the team to investigate as this appears like a bug. 

    Thanks!

    0
  • Milan Wack

    Kristina Tibbitts
    In our case, it is up and running again. (Maybe give it a new try :-) ) 

    0
  • Nancy Scanlon

    We are also experiencing this, and we must have TOCs in the top of our articles. (VERY frustrating that we cannot use a proxy TOC, but that's another story for another day.)

    Can someone from ZD please respond with an update as to when we can expect a fix for this issue?

    0
  • zendeskagent

    We are able to see the contents in the heading, However, when we try to link with in the article, It jumps to other section of the article. 

    Zendesk team, can someone help me on this. 

    1
  • Milan Wack

    Zendesk Devs 

    0
  • Casey

    Hey Y'all - Looks like the bug is fixed. Was able to create and link to headings on a fresh article this morning.

    0
  • Dganit Rauchwerger

    Hey everyone, this was working for me for a few days and today again, no luck - I don't see my headings again...

    Very frustrating. Are others experiencing the same?

    0
  • Giuseppe
    Zendesk Customer Care

    Hi Dganit,

    I understand this can be frustrating. I've tested this on multiple accounts but I'm not able to replicate the issue. Adding a link to heading seems to be working properly:

     

     

    Since this has worked before, and only stopped working recently, we may want to ensure that this is not a browser-caused issue by following the steps in this article - Options to clear cache and cookies.

    0
  • Dganit Rauchwerger

    Hi Giuseppe, things seem to be fine now. Thanks for your assistance.

    0
  • Janine Deegan

    I'd like "Open in a new tab" to be defaulted On. Is there any way to do that?

    2
  • Jupete Manitas
    Zendesk Customer Care

    Hi Janine, thanks for writing in! I see that you would like that "Open in a new tab" to be defaulted On. Unfortunately, this is something created natively and we don't have the settings in our admin to make it default as selected. However, you can post a product feedback in our Guide about this. Here is our link for Guide - Product feedback. Thank you!

    0
  • Tommy Nicholls

    Hello, I was wondering, if I update the title of an article, do I have to manually update all the links to that article elsewhere in the knowledge base? In this instance, the links are in a "See also" Section at the bottom of articles, and the "Text on Link" is the title of the article.


    Thank you for your time.

    0
  • Brett Bowser
    Zendesk Community Manager
    Hey Tommy, 
     
    If you update the article title then they should also be updated when viewing all articles within a section as well. That being said, if you referenced an article by title in another article then those would need to be updated manually. 
     
    Let me know if I'm misunderstanding your question!
     
     
    0
  • Rebeca Hernandez

    Hello, do you have any best practices for adding links to articles and then managing translations?

    We have translated more than 100 articles and had to spend a lot of time checking article by article and manually changing the links to the correct language.

    Any input is appreciated, thanks!

     

    0
  • Anne Ronalter
    Zendesk Customer Care
    Hi Rebeca,

    Thank you for your Feedback on that.

    Natively this is unfortunately not possible, but as a workaround, you can use Google Analytics for finding broken links to deleted pages:
    https://support.zendesk.com/hc/en-us/articles/4408883297690#topic_ys2_rr3_gn
    0
  • Jennifer Rowe
    Zendesk Documentation Team

    Hi Rebeca Hernandez

    I know you might not have dev resources to help with this, but just thought I'd mention that we run a script to update links in all our translations when we publish them. That's how we manage it for the documentation here at Zendesk.

    Unfortunately there's not a a native solution, as Anne mentioned.  

    1
  • Rebeca Hernandez

    Thanks for the answer Anne Ronalter.

    Jennifer Rowe where can I find more information about this script? we work with some developers, and I could bring this up with them.

    Thanks in advance!

    0
  • Jennifer Rowe
    Zendesk Documentation Team
    Hi Rebecca,
    We haven't published anything about the script we use and I don't know anything more about it. 
     
    The person on our team who created the script is currently on leave, but I'll ask him to provide more info if he can when he's back. That won't be until next month though. Sorry for the wait!
    1
  • James Rodewig
    Zendesk Documentation Team

    Hi Rebeca,

    Sorry to hear you're having to manually update all those links. Sounds exhausting!

    If you haven't yet, I recommend reading our Using the Help Center API to manage article translations article in the Developer Docs. It gives you some tips for using code to handle your help center translations. We tried to make the article beginner-friendly, so I hope it's useful even if you don't have any prior programming experience.

    Toward the end of the article, there's a section that covers uploading translations as a deliverable. If you're uploading translations from JSON like in the article, you can add a line to the Python script in that section to update Help Center links in your translations. The line essentially finds and replaces /hc/en-us/ in your translations with /hc/{locale}/.

    Here's the modified script (the new line starts with article['body']):

    import json

    import requests

    auth = ('your_email', 'your_password')

    print('- reading deliverable file')

    with open('2021-04-15_deliverable.json', mode='r', encoding='utf-8') as f:

    deliverable = json.load(f)

    for locale in deliverable:

    print(f'\n- uploading {locale} translations')

    for article in deliverable[locale]:

    article_id = article['id']

    article['body'] = article['body'].replace('/hc/en-us', '/hc/' + str(locale))

    # get missing translations to determine if should use a PUT or POST request

    url = f'https://example.zendesk.com/api/v2/help_center/articles/{article_id}/translations/missing.json'

    response = requests.get(url, auth=auth).json()

    missing_translations = response['locales']

    if locale in missing_translations:

    # new translation -> do a POST request

    print(f' - posting translation for article {article_id}')

    post_url = f'https://example.zendesk.com/api/v2/help_center/articles/{article_id}/translations.json'

    data = {'translation': {'locale': locale, 'title': article['title'], 'body': article['body']}}

    response = requests.post(post_url, json=data, auth=auth)

    else:

    # existing translation -> do a PUT request

    print(f' - putting translation for article {article_id}')

    put_url = f'https://example.zendesk.com/api/v2/help_center/articles/{article_id}/translations/{locale}.json'

    data = {'translation': {'title': article['title'], 'body': article['body']}}

    response = requests.put(put_url, json=data, auth=auth)


    As a note, there is a typo in the article snippet (https://example.zendesk.com is written as https://example.zendesk.com.zendesk.com). I fixed the typo in the script above and will update the article shortly.

    I hope that helps! 

    2
  • Rebeca Hernandez

    James Rodewig this is great, thank you so much for the help.

    0
  • Rebeca Hernandez

    James Rodewig I was looking into this code, for translations, we use the tool Lingpad to pull the content, translate and then push the content back to Zendesk Guide, would this code be applicable for something like this?

    Thanks in advance!

    0
  • James Rodewig
    Zendesk Documentation Team

    Hi Rebeca,

    Unfortunately, I'm not familiar with Lingpad or how they push translations to your help center.

    However, you can use the following Python script to update links in translated articles once they're in your help center (likely after Lingpad pushes the content):

    import requests

    auth = ('your_email', 'your_password')
    subdomain = 'your_zendesk_subdomain'
    article_ids = ['1', '2'] # Article ids to update

    # Get a list of locales for the help center, excluding the default locale
    url = f'https://{subdomain}.zendesk.com/api/v2/help_center/locales'
    response = requests.get(url, auth=auth).json()
    locales = response['locales']
    default_locale = response['default_locale']
    locales.remove(default_locale)

    for article_id in article_ids:
    for locale in locales:

    # Get the translation for the article
    get_url = f'https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/translations/{locale}.json'
    get_response = requests.get(get_url, auth=auth).json()
    translation_body = get_response['translation']['body']

    # Update help center links in the translation
    print(f'article {article_id}: Updating links for {locale} translation')
    put_url = f'https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/translations/{locale}.json'
    translation_body = translation_body.replace('/hc/' + str(default_locale), '/hc/' + str(locale))
    data = {'translation': { 'body': translation_body}}
    requests.put(put_url, json=data, auth=auth)


    Unlike the previous script, this one doesn't require a JSON file containing the translations. Instead, you just need to replace the auth, subdomain, and article_ids values at the top of the file with your own values. article_ids should contain the list of article ids you'd like to update.

    I suggest trying this script out with a test article (or even a test account) before using it in production or on a larger scale.

    Please also note that we can't guarantee the above code or provide support for the script. However, I hope it's enough to get you started and help you explore the Help Center APIs on your own.

    Best of luck!

    0

Please sign in to leave a comment.

Powered by Zendesk