<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Adam Pritzl - Software Developer/Consultant]]></title><description><![CDATA[Adam Pritzl's website and blog about software development and consulting]]></description><link>https://www.adampritzl.com</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Mar 2018 15:59:02 GMT</lastBuildDate><item><title><![CDATA[Building Static Sites with Gatsby]]></title><description><![CDATA[What is Gatsby? So I've purchased adampritzl.com and decided to create a website for myself to share what I learn with you.  Static sites…]]></description><link>https://www.adampritzl.com/gatsby-static-sites</link><guid isPermaLink="false">https://www.adampritzl.com/gatsby-static-sites</guid><pubDate>Mon, 05 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h2&gt;What is Gatsby?&lt;/h2&gt;
&lt;p&gt;So I&apos;ve purchased adampritzl.com and decided to create a website for myself to share what I learn with you.  Static sites are the direction I want to go and I heard Wes and Scott talking about &lt;a href=&quot;https://www.gatsbyjs.com&quot;&gt;Gatsby&lt;/a&gt; on the &lt;a href=&quot;https://syntax.fm/&quot;&gt;Syntax FM Podcast&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Gatsby is a static site generator built on top of React.  You can bring your own data from various CMSs, markdown, and there is a big list of others.  The data is pulled in using prebuilt &lt;a href=&quot;https://www.gatsbyjs.org/docs/plugins/&quot;&gt;plugins&lt;/a&gt; and queried using GraphQL.&lt;/p&gt;
&lt;p&gt;Since React is my front-end framework of choice these days, it was the perfect fit.&lt;/p&gt;
&lt;h2&gt;How does Gatsby work?&lt;/h2&gt;
&lt;p&gt;Since Gatsby is based on React, it uses components to create the website.  There are four major &lt;a href=&quot;https://www.gatsbyjs.org/docs/building-with-components/&quot;&gt;components&lt;/a&gt; that are used to build a Gatsby site.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Html&lt;/strong&gt; - This includes the html, head, and body tags.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Layout&lt;/strong&gt; - This is an optional component that wraps page components.  It is used for things like headers, footers, and navigation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Page template&lt;/strong&gt; - This component is used for programmatically building pages.  For example, turning markdown into html pages.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Page&lt;/strong&gt; - Components build with this become pages on your site.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Do I need to know Webpack?&lt;/h2&gt;
&lt;p&gt;In most cases you will not need to do any webpack configuration.  There are many prebuilt &lt;a href=&quot;https://www.gatsbyjs.org/docs/plugins/&quot;&gt;plugins&lt;/a&gt; that will do things like SASS processing, or add TypeScript support.  If you find there is not a plugin that solves your problem and it is a general one, why not contribute back to the open source community and create a plugin?&lt;/p&gt;
&lt;h2&gt;What are plugins?&lt;/h2&gt;
&lt;p&gt;Plugins are NPM packages you can pull in to your Gatsby project to solve website build tasks.  Plugins are loaded and configured by your gatsby-config.js file.  The three major classes of plugins are source, transform, and build.  Source plugins allow you to pull data from different sources like a CMS, markdown files, or some API.  Transform plugins allow you to take a format of data like markdown, or JSON, and turn it into html.  Build plugins help you do your webpack type tasks like compiling SASS files.&lt;/p&gt;
&lt;h2&gt;What is GraphQL&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://graphql.org/&quot;&gt;GraphQL&lt;/a&gt; is a language for describing APIs of various kinds. In the context of Gatsby, it creates an interface between your data sources and your static site.  For the purpose of building a blog, I&apos;m using it to query my markdown files and build my static blog pages.  Gatsby has a fantastic live IDE built in for creating queries.  It can be found as follows.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot;&gt;
      &lt;pre class=&quot;language-html&quot;&gt;&lt;code&gt;http://localhost:8000/___graphql
&lt;/code&gt;&lt;/pre&gt;
      &lt;/div&gt;
&lt;h2&gt;Building a blog&lt;/h2&gt;
&lt;p&gt;Gatsby has a bunch of great starter projects from both Gatsby and the community.  Today we will take a look at the official starter, &lt;a href=&quot;https://github.com/gatsbyjs/gatsby-starter-blog&quot;&gt;gatsby-starter-blog&lt;/a&gt;.  To get started just type the following.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot;&gt;
      &lt;pre class=&quot;language-powershell&quot;&gt;&lt;code&gt;gatsby new blog https:&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;github&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;com&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;gatsbyjs&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;gatsby&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;starter&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;blog
&lt;/code&gt;&lt;/pre&gt;
      &lt;/div&gt;
&lt;p&gt;This will create a directory called blog, clone the github repo and run npm install.  To start up the development server just type &lt;code&gt;gatsby dev&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Ok, now we are ready to start building our site for the blog.  We will need to use some of the plugins I mentioned before.  &lt;/p&gt;
&lt;p&gt;We need to get our blog data from somewhere.  A popular method for publishing blog posts is to create them in markdown.  First, we need to get the .md file from disk.  We&apos;ll use the source plugin, &lt;a href=&quot;https://www.gatsbyjs.org/packages/gatsby-source-filesystem/&quot;&gt;gatsby-source-filesystem&lt;/a&gt;, to do this.  This plugin will create a set of File nodes from the directory specified in the config.  You can query these nodes from GraphQL, or use a transformer plugin to convert the file data into another form.&lt;/p&gt;
&lt;p&gt;This is where the &lt;a href=&quot;https://www.gatsbyjs.org/packages/gatsby-transformer-remark/&quot;&gt;gatsby-transformer-remark&lt;/a&gt; plugin comes in.  It will parse the markdown files into MarkdownRemark nodes.  These nodes can be queried by GraphQL in our page template component and used to build each page using that template.&lt;/p&gt;
&lt;p&gt;If you are writing a technical blog you might want to display code in a nice way.  The &lt;a href=&quot;https://www.gatsbyjs.org/packages/gatsby-remark-prismjs/&quot;&gt;gatsby-remark-prismjs&lt;/a&gt;.  This allows you to wrap your code in markdown language tag and display the proper syntax highlighting.&lt;/p&gt;
&lt;p&gt;You also might want to publish and link some files with your blog.   By using &lt;a href=&quot;https://www.gatsbyjs.org/packages/gatsby-remark-copy-linked-files/&quot;&gt;gatsby-remark-copy-linked-files&lt;/a&gt; you simply copy your file alongside your .md file, link it, and the build process will copy the file the root of the public directory by default.&lt;/p&gt;
&lt;p&gt;You&apos;ll also have to deal with images while creating your blog.  Using the &lt;a href=&quot;https://www.gatsbyjs.org/packages/gatsby-remark-images/&quot;&gt;gatsby-remark-images&lt;/a&gt; plugin will create multiple versions of the image for different widths,  wrap your image in a container to prevent content from jumping around, and add a blur up effect where while the image is still loading it will use a blurred version as the place holder.&lt;/p&gt;
&lt;p&gt;You are also going to want people to subscribe to your blog don&apos;t you? You can use the &lt;a href=&quot;https://www.gatsbyjs.org/packages/gatsby-plugin-feed/&quot;&gt;gatsby-plugin-feed&lt;/a&gt; to build an rss.xml file using GraphQL that your readers can subscribe to using their favorite RSS feed reader.&lt;/p&gt;
&lt;h2&gt;Deployment &amp;#x26; Hosting&lt;/h2&gt;
&lt;p&gt;There are a bunch of services you can host on such as Amazon S3, Netlify, GitHub Pages, Surge.sh.  I chose &lt;a href=&quot;https://www.netlify.com/&quot;&gt;Netlify&lt;/a&gt;.  It&apos;s screaming fast, has built in continuous delivery, and free SSL using Let&apos;s Encrypt.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;As you can see Gatsby + Netlify is a terrific way to get your blog up and running. Gatsby is a rich extendable static site generator.  It&apos;s not only good for creating blogs but for creating any site rich with content.  Users can continue creating content with familiar tools. Just choose the source and transform plugins that fit, or develop one yourself.&lt;/p&gt;
&lt;p&gt;Next, I&apos;d like to implement a tagging system for organization.  GraphQL will be a perfect fit to create a tag component.  I&apos;ll do that once I get a couple posts under my belt.  Now go build yourself a website!&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Hello World]]></title><description><![CDATA[This is my first post on my new blog! How exciting!  Stay tuned for my first post about how to stand up a website using gatsby.js and…]]></description><link>https://www.adampritzl.com/hello-world/</link><guid isPermaLink="false">https://www.adampritzl.com/hello-world/</guid><pubDate>Sat, 06 Jan 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This is my first post on my new blog! How exciting!  Stay tuned for my first post about how to stand up a website using gatsby.js and netlify.&lt;/p&gt;</content:encoded></item></channel></rss>