// Add the “Back to Home” action link
function addBackToHomeActionLink() {
// Create a new link (anchor) element
const homeLink = document.createElement(‘a’);
homeLink.textContent = ‘Back to Home’;
homeLink.href = homePageUrl;
homeLink.classList.add(‘kn-link’, ‘kn-link-1’);
homeLink.style.display = ‘block’;
homeLink.style.marginTop = ‘-45px’; // Change this to move link to your preference
// Insert the link after the table view container
const tableView = document.querySelector(tableViewSelector);
if (tableView) {
tableView.parentNode.insertBefore(homeLink, tableView.nextSibling);
}
}
// Add the back link when the view is rendered
$(document).on(‘knack-view-render.view_123’, function(event, view, data) {
addBackToHomeActionLink();
});