Overview
When using absolute URLs/paths linked to liquid content assets in Visualizer, you might encounter several error 404 prompts when opening the links after a site migration. This article provides information about how absolute and relative URLs/links work, including their differences and current limitations.
Prerequisites
- Generate an API Key
- An API Client such as Postman
Solution
Using absolute URLs linked to liquid content assets allows the content to be available on different platforms (different websites, mobile applications, etc.). These URLs are preferred since assets might not be hosted in all other locations if relative URLs are used.
However, it is still possible to use relative URLs by using different fields such as Single Line Text instead of Assets, which will allow you to use relative URLs for assets (i.e., images) as simple text. This process requires extra work on your existing Content-Type/Visualizer and content items.
To use relative URLs, you need to replace the asset source in the Visualizer template with the new field: src=<source/path>
. Additionally, content creators need to upload images/documents first to the Assets menu before locating the absolute URL to add the Single Line field to the content item.
By using the Liquid Content API, you will be able to update all the URLs of the content items whenever the site URL is modified:
-
Get all content items that have the old domain:
GET https://dnnapi.com/content/api/ContentItems?searchtext=<olddomain>
-
For each content item, replace
http://<oldomain>
withhttps://<newdomain>
, and update its details:PUT https://dnnapi.com/content/api/ContentItems/contentitem/<ID>?publish=true
Comments
0 comments
Please sign in to leave a comment.