How to add javascript to an html card when creating a new post?

45 Views Asked by At

I am trying to create my first blog post using the ghost editor. I need to add some dynamic content in the title e.g. "How to make a good youtube video in 2023". However, I want the date to be dynamic so that I don't need to manually update it when will be in 2024.

I tried to add the title as an HTML card but it doesn't work

<html>
   <head>
      <title></title>
   </head>
   <body>
       <h1 id="year"></h1>
      <script>
         var dt = new Date();
          var year = document.getElementById("year")
          year.innerHTML = dt.getFullYear()
      </script>
   </body>
</html>

Nothing is displayed. It seems only the HTML is recognized, not the javascript.

Do i make something wrong ?

0

There are 0 best solutions below