My Microblog

Speaking of no limits, I can also share my code blocks with you to help you learn how to work with Astro or Hygraph.

Here's the code from the PostContent component of this website:

const PostContent = ({ post }) => {
  const { content, slug, createdAt } = post;

  const dateString = new Date(createdAt).toLocaleDateString("en-US", {
    dateStyle: "full",
  });
  const timeString = new Date(createdAt).toLocaleTimeString("en-US", {
    timeStyle: "short",
  });

  return (
    <>
      <div dangerouslySetInnerHTML={{ __html: content.html }}></div>
      <time dateTime="{createdAt}">
        <a href={`/posts/${slug}`}>
          {dateString} at {timeString}
        </a>
      </time>
    </>
  );
};

export default PostContent;