Skip to content

Latest commit

 

History

History
60 lines (25 loc) · 1.01 KB

Static Site Generators.md

File metadata and controls

60 lines (25 loc) · 1.01 KB

Static Site Generators

s

Static site generators are tools that generate static HTML, CSS, and JavaScript files from templates and content. They can be used to create fast, secure, and scalable websites that are easy to deploy and maintain. Some popular static site generators include Jekyll, Hugo, and Gatsby. Here's an example of using Gatsby to create a simple blog:

import React from 'react';

import { graphql } from 'gatsby';

export default function BlogPost({ data }) {

const post = data.markdownRemark;

return (

<div>

  <h1>{post.frontmatter.title}</h1>

  <div dangerouslySetInnerHTML={{ __html: post.html }} />

</div>

);

}

export const query = graphql`

query($slug: String!) {

markdownRemark(fields: { slug: { eq: $slug } }) {

  frontmatter {

    title

  }

  html

}

}

`;

In this code, we're using Gatsby to create a blog post template.