Other Views: By Month | By Category | By Tag Cloud

Git: Delete Merged Local Branches That No Longer Exist with Powershell

Previously, I wrote about how to delete git branches that have been merged and no longer exist on the remote using git bash. Using git bash worked just fine for this. However, my normal shell is PowerShell and I want to stay in PowerShell.

In this post, we will look at how to use PowerShell instead to delete your local git branches that have been merged and no longer exist on the remote.

Read More

Hugo - Dynamically Add Copy Code Snippet Button

I have many posts on this site that include code snippets for the reader to cut and paste into their code. From a usability perspective, instead of always making the user select lines from the code snippet to copy and paste, we can add a copy button to the code snippet.

example without line numbers:

copy button example

example with line numbers:

copy button example with line numbers

This post will look at how to implement the copy button, as you see in the above images, any time that we detect a code snippet on a post.

Read More

Hugo - Add Preview When Sharing to Twitter

When you share your blog post on Twitter, you can attach photos, videos and media experiences to Tweets, which helps to drive traffic to your site.

This is called a Twitter card and looks like:

twitter card example

There are two types of Twitter Cards that we are concerned with for our site

  1. Summary Card: Title, Description, and Thumbnail (optional)
  2. Summary Card with Large Image: Similar to the Summary Card but with a prominently featured image

Read More

Hugo - Add Contact Form Using Formspree

When creating your blog, it is a good idea to have a contact me form. With static sites though you do not have server side processing available to send you an email with from the contact me form submission.

To overcome not having server side processing available, we are going to use Formspress.

Formspree is free for up to 50 submissions per month.

Read More

Hugo - Create a 404 Page

Every website should have a 404 page for when a user tries to go to a page that does not exist.

Hugo out of the box does not provide you with a nice 404 page but we can create a 404 page just like any other page. Creating the page though is the easy part. The hard part is getting the 404 page to display when a user goes to an invalid url as it depends on your website host to set up the 404 page redirect0000.

For this site, I am hosting it using Netlify and they automatically pick up my 404 page.

Let’s take a look at how to create our 404 page.

Read More

Hugo - Minify JS and CSS

When you think about a website’s performance, you should minify your CSS and JavaScript file so that they download as quickly as possible. This still holds true even with static sites like Hugo. Luckily, Hugo can minify files out of the box using what Hugo calls Asset Pipeline.

In this post, I will show you how to take advantage of the Hugo Asset Pipeline to minify your CSS and JavaScript.

Read More

Take your Windows Terminal and PowerShell to the next level

I was watching the Bald Bearded Builder, Michael Jolley, and I had shell envy as I watched him use PowerShell terminal. His terminal showed the git status, node version, folder/file icons, cool color scheme, and predictive completion when typing commands based on his PowerShell history.

Michael’s PowerShell Terminal

I asked Michael in chat if he would be willing to share his PowerShell profile which he was nice enough to do right then and there on stream.

However, even with his PowerShell profile in hand, it still took me a bit of time to figure out what I needed to do to take advantage of the profile.

Let’s walk through the steps I took to get my she’ll working like Michael’s.

Read More

Hugo - Integrate Google Search

As your site content grows, finding content will become harder and you will need to add the ability to search your content.

You could create your own client search using something like lunr.js but then you have to maintain the search code and deal with any issues that come up. To me this is a distraction from the real goal of publishing content on your site.

So instead, I prefer to harness the power of Google to search my site using the handy search argument site: to tell Google to just search my site for the search term.

In this post, we are going to create a search page that will take the reader to Google for the search results.

Read More

Hugo - Add Additional Non-Blog Pages

So far in our Hugo series we have only looked only blog related page such as posts and archives but typically you have other pages such as an about, search, or contact us.

In this post, we are going to take a look at how you can add an about page.

In future post, we will look at the search and contact pages. They follow the same instructions but the layout/content is much different than just a headshot and bio.

Read More

Hugo - Create a Post Series

When writing a blog, sometimes you want to write a multiple part posts that are meant to be read in order and you want to display to the reader that the post is part of a series, where the post is in the series and a link to get to the other posts in the series.

Out of the box, Hugo does not offer the ability to display the list of posts that are part of the series. Luckily, Hugo has all of the pieces to create one yourself, which we are going to do in this post.

Here is an example of what we are going to build.

example series

Read More