Siteimprove - How to Find and Repair Links to Drupal Stage Sites
SSU's Drupal platform has Test, Stage and Production servers which allow the Drupal team and content leads to build and test Drupal sites before going live. Unfortunately, sometimes content authors create links to Drupal pages and files using absolute URLs instead of relative URLs.
This leads to Stage site URLs being used on live production sites. These links are found and crawled by search engines, leading to bad and incorrect links in search results.
Links to the stage server always include "dstg0" in the URL.
Effective June 5, 2022, our old local stage server has been decommissioned. All links with URLs containing "dstg0.sonoma.edu" are now broken.
Absolute URLs vs Relative URLs
An absolute URL is the full address of the page or file, beginning with the protocol, site and domain name, and full path to the resource.
https://www.sonoma.edu/about/mission
/kb/website-support/drupal-how-make-link
A relative URL contains only a path to the resource, from the starting point of the page the link is on, or from the site's root like these.
/about/mission
/kb/website-support/drupal-how-make-link
Siteimprove uses the Policy feature that scans SSU websites and looks for links that point to the stage and test sites. SSU content authors should use the policy "HTML source match dstg0.sonoma.edu →" to find and correct these links.
Note: You should also look for the policy links for our legacy webserver, and links using "drupal-vip" in the URLs. These should also be repaired.
- Links to SSU's Legacy Webserver - Needs to be updated
- HTML source match drupal-vip.sonoma.edu
Instructions
- Login to your Drupal site.
- In a new tab, login to Siteimprove.
- Pull down the Groups select menu and choose your site.
- Make sure you are in the Dashboard "Accessibility and Quality Assurance".
- Scroll toward the bottom, and find the widget labeled "Policies with the most matches".
- Click on "HTML source match dstg0.sonoma.edu →"
- If you don't see that policy listed, click "View whole list of your policies" and then look for the link.
- On the Policy Details page, you'll see a chart showing the number of matches found over last 6 months, and a table listing all the pages that have links to URLs using dstg0. Click on a page in the list. This opens the page report in the Policy view. The Policy view cannot identify and outline the relevant portion of the page in the Content view.
- Click the Show HTML button.
- The relevant link in the HTML will be highlighted and underlined. Read the full URL and nearby text to identify the content and link that must be updated.
- Note: some pages will have more than one occurrence of a dstg0 URL. Look for the Occurrences button in the upper right area of the HTML view to switch to other occurrences.
- Click the page's link at the top of the Siteimprove page report to go to the page in Drupal to make repairs.
- Click New Draft.
- In the HTML editor, find the link that needs to be fixed.
- Click the a tag in the tag selector area.
- Click Remove Link.
- Following the instructions "Drupal - How to Make a Link", create a correct link to the page or file.
- If the link is to something on the same Drupal site, using the Link to Content button This will make a relative link using the resources Drupal ID number. Drupal automatically converts this to a human-friendly URL. Added benefit: if the page's path ever changes (if the page is moved in the menu or renamed), Drupal will update the human-friendly URL, preventing the link from breaking.
- If the link is to something on a different site, find the production version of that site and resource, and copy the link from the browser. Then use the Link button to make the link.
- If the dstg0 URL is being used for an image, click the Add image button to select the image. If the image doesn't exist on your production Drupal site, you will need to upload the image from your computer, or replace the image with a different one.