Skip to content

Instantly share code, notes, and snippets.

@kartiknair
Created March 10, 2020 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kartiknair/3d985cc8d1d41f22fc72dac49bc3ac0b to your computer and use it in GitHub Desktop.
Save kartiknair/3d985cc8d1d41f22fc72dac49bc3ac0b to your computer and use it in GitHub Desktop.
const homepage = posts => `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="${config.blogDescription}" />
<title>${config.blogName}</title>
</head>
<body>
<div class="grotesk">
<header>
<h1>${config.blogName}</h1>
<p>—</p>
<p>This blog is written by ${config.authorName}, ${
config.authorDescription
}. To find out what he's up to <a href="${
config.authorTwitter
}">follow him on twtter</a></p>
<hr />
</header>
<div class="posts">
${posts
.map(
post => `<div class="post">
<h3><a href="./${post.path}">${
post.attributes.title
}</a></h3>
<small>${new Date(
parseInt(post.attributes.date)
).toDateString()}</small>
<p>${post.attributes.description}</p>
</div>`
)
.join("")}
</div>
<footer>
${`<p>© ${new Date().getFullYear()} ${
config.authorName
}, Find the code on <a href="github.com/kartiknair/blog">GitHub</a></p>`}
</footer>
</div>
</body>
</html>
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment