Issue
- I have a hardcoded button to a web content that is now going to a 404 page.
- My link to Liferay content is now breaking.
Environment
- DXP 7.4
- Quarterly Release
Resolution
- Hardcoding links to Liferay content can break if any changes are made to the URL and are not considered best practice.
If changes are made, such as changing the friendly URL or applying Display Page Templates, the URL to the content may change, and cause hardcoded links to result in 404 pages instead.
Instead, please consider mapping the fragment to the content instead.
Example steps for mapping a button to link to a Basic Web Content (with a Display Page Template applied) would be as follows:
- Place a button on a page.
- Select the button, and then select 'link' in the left-hand column.
- [To change the text of the button] On the Mapping tab, click on the 'Item' field and select the appropriate Basic Web Content. For 'Field', select the appropriate field type (i.e. 'Title').
- [To change the link of the button] On the Link tab, click on the 'Link' field and select 'Mapped URL'.
- For 'Item', select the appropriate Basic Web Content. For 'Field', select a Display Page.
Additional Information