Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script>
var projectTitle;
var projectTitleText = document.querySelector('.centered-content > h4');
var checkGallery = document.querySelector('.gallery-section')
var link = window.location.href + '?format=json-pretty';
fetch(link).then(response => {
console.log('success', response);
return response.json();
}).then(data => {
console.log(data.collection.title);
projectTitle = data.collection.title;
if(projectTitle !== "HOME" && checkGallery !== null) {
projectTitleText.textContent = projectTitle;
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment