You can dynamically change any HTML element with JavaScript.
If you have some text in another file , you could fetch()
the file and then assign its content to the <title>
:
<!DOCTYPE html>
<html>
<head>
<title>Old Title</title>
<meta name="description" content="Old description">
</head>
<body>
<script>
/* text file in the same directory with the new title */
fetch('title.txt')
.then(response => response.text())
.then(text => document.title = text)
/* This text could also be fetched from a file */
document.querySelector('meta[name="description"]').content = 'New description';
</script>
</body>
</html>
You could also have all the new data formatted as JSON and saved in a file. You would then use response.json()
instead of response.text()
to directly parse it into an object.
Does that help you?
Have a nice day,
Michael