Skip to content

Commit

Permalink
fix some paths, formatting etc. also simplified posts url.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-drewery committed Jun 30, 2023
1 parent 8b3f5cd commit 589d23e
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 21 deletions.
4 changes: 2 additions & 2 deletions content/index.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"making-a-blog": {
"title": "Setting up a blog in GitHub Pages using Blazor WASM",
"description": "I achieved a blogception by creating a blog then blogging about the blog from within the blog itself. This is what I've decided to refer to as \"recursive metablogging\".",
"title": "How I Set up a Blog in GitHub Pages using Blazor WASM",
"description": "This is an article about how I made this site. It specifically covers how I set up the github pages page, and the github actions pipelines.",
"date": "30-06-2023",
"image": "blogception.png",
"tags": [
Expand Down
6 changes: 3 additions & 3 deletions content/making-a-blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ I paid for some overpriced crappy template to get me started because my frontend
### Configure GitHub Pages
By default, GitHub page sites are deployed from the master branch. Obviously this isn't going to work with a blazor project, we need to get it all compiled up first. So first thing I did was change the deployment method in github to "GitHub Actions".

![configuring github pages](making-a-blog/setup-github-pages.png "configuring github pages")
![configuring github pages](https://raw.githubusercontent.com/adam-drewery/blog/main/content/making-a-blog/setup-github-pages.png "configuring github pages")

At this point I also got the domain name set up, the instructions tell you exactly what to do and it takes about 2 minutes. Plus, I enabled HTTPS-only while I was in here for security and privacy reasons.

Expand Down Expand Up @@ -98,7 +98,7 @@ Here you can see it uses the same `permissions` block as in the build job. I als

Other than that though the release part is really simple. It gets the artifact we uploaded in the previous job and yeets it into GitHub pages, easy peasy.

![configuring github actions](making-a-blog/build-github-pages.png "configuring github actions")
![configuring github actions](https://raw.githubusercontent.com/adam-drewery/blog/main/content/making-a-blog/build-github-pages.png "configuring github actions")

### Fix the paths

Expand Down Expand Up @@ -127,6 +127,6 @@ So, I added a step to the build job to copy the blazor runtime into the release

Probably doesn't require too much explanation as to what's going on here... its pretty filthy though, I felt like I had to take a shower afterwards. I wish there was a better way to do this.

But anyway, if its stupid and it works, then its not stupid! So, I'm happy with it.
But anyway, if its stupid and it works, then its not stupid! So, I'm happy with it. You can see the completed pipeline yaml file [here](https://github.com/adam-drewery/blog/blob/main/.github/workflows/build.yml).

I'll write another post at some point describing how I built the site itself. I had quite a bit of fun with it if I'm honest... frontend development has gotten more fun now I can delegate the tedious bits to ChatGPT. 😎
2 changes: 1 addition & 1 deletion rss/generate-rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ for (const articleId in index) {
feed.item({
title: article.title,
description: marked(markdown),
url: `https://blog.drewery.uk/post/${articleId}`,
url: `https://blog.drewery.uk/${articleId}`,
date: article.date,
author: 'Adam Drewery',
});
Expand Down
16 changes: 8 additions & 8 deletions site/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,31 @@
<article class="post">
<div class="post-header">
<h2 class="post-title">
<a href="/post/@post.Id">@post.Title</a>
<a href="/@post.Id">@post.Title</a>
</h2>
<ul class="post-meta">
<li>
<i class="mdi mdi-calendar"></i> @post.Date
</li>
@{ var delimiter = ""; }
<li>
<i class="mdi mdi-tag-text-outline"></i>
@foreach (var tag in post.Tags)
{
<li>
<i class="mdi mdi-tag-text-outline"></i>
<a href="/tag/@tag">@tag@delimiter</a>
</li>
<a href="/tag/@tag">@delimiter @tag</a>
delimiter = ", ";
}
</li>
<li>
<i class="mdi mdi-comment-multiple-outline"></i>
@{ var commentLabel = post.CommentCount == 1 ? "comment" : "comments"; }
<a href="/post/@post.Id">@post.CommentCount @commentLabel</a>
<a href="/@post.Id">@post.CommentCount @commentLabel</a>
</li>
</ul>
</div>
<div class="post-preview">
<a href="/#">
<img src="@(Path.Combine(SiteContext.BaseContentAddress, post.Image))" alt="" class="img-fluid rounded">
<a href="/@post.Id">
<img src="@(Path.Combine(SiteContext.BaseContentAddress, post.Id, post.Image))" alt="" class="img-fluid rounded">
</a>
</div>
<div class="post-content">
Expand Down
2 changes: 1 addition & 1 deletion site/Pages/Post.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@inject HttpClient Http
@inject SiteContext SiteContext
@inject IJSRuntime JsRuntime
@page "/post/{Id}"
@page "/{Id}"
@using Markdig

@code {
Expand Down
2 changes: 1 addition & 1 deletion site/Pages/Search.razor
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<div class="post-header">
<h2 class="post-title">
<a href="/post/@post.Id">@post.Title</a>
<a href="/@post.Id">@post.Title</a>
</h2>
<ul class="post-meta">
<li>
Expand Down
2 changes: 1 addition & 1 deletion site/Pages/Tag.razor
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<article class="post">
<div class="post-header">
<h2 class="post-title">
<a href="/post/@post.Id">@post.Title</a>
<a href="/@post.Id">@post.Title</a>
</h2>
<ul class="post-meta">
<li>
Expand Down
4 changes: 2 additions & 2 deletions site/Shared/Archives.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<li>

<div>
<a href="/post/@post.Id">@post.Title</a>
<a href="/@post.Id">@post.Title</a>
</div>
<div>
<a style="font-size: x-small" href="/post/@post.Id">@post.Date</a>
<a style="font-size: x-small" href="/@post.Id">@post.Date</a>
</div>
</li>
}
Expand Down
2 changes: 1 addition & 1 deletion site/Shared/RecentEntries.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</a>
</div>
<div class="wb">
<a href="/post/@post.Id">@post.Title</a> <span class="post-date">@post.Date</span>
<a href="/@post.Id">@post.Title</a> <span class="post-date">@post.Date</span>
</div>
</li>
}
Expand Down
4 changes: 3 additions & 1 deletion site/SiteContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public async Task Reload()
{
var title = postComments.Title.Split("/").Last();
var commentCount = postComments.Comments;
posts[title].CommentCount = commentCount;

if (posts.TryGetValue(title, out var post))
post.CommentCount = commentCount;
}

foreach (var post in posts)
Expand Down

0 comments on commit 589d23e

Please sign in to comment.