Skip to content

Commit 4fc9fdb

Browse files
authored
Merge pull request #81 from de-soot/main
new post on 2nd differences
2 parents 1dd5628 + 0883754 commit 4fc9fdb

File tree

6 files changed

+294
-55
lines changed

6 files changed

+294
-55
lines changed

_posts/2024-05-24-giscus-comments.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@ categories: comments, giscus, github pages, github discussions, static websites
66
permalink: /giscus-comments
77
---
88

9+
## Preamble
10+
911
I added a commenting feature for the blog using [giscus][giscus]. Basically, it uses [Github Discussions][discussions-docs] to store comments instead of storing it in its own database on the web server. Since this website is hosted on [Github Pages][pages-docs] and Pages only supports static websites, it cannot host its own databases to store things such as comments. This guide explains how to add giscus comments to statically-hosted websites, and some quirks and caveats with using Github Discussions as a database for your comments.
1012

11-
# Try it
13+
## Try it
1214

1315
You can test it out yourself on this blog post in the comments below by signing into your Github account and commenting, or you can comment on the [Github Discussions post](https://github.com/de-soot/de-soot.github.io/discussions/22) directly and it will show up on the comments section on the website similarly.
1416

15-
# Add it to your own Github Pages website
17+
## Add it to your own Github Pages website
1618

1719
1) Make sure to enable Github Discussions on your website's Github repository.
1820

1921
2) Navigate to `giscus.app` on your browser's address bar and follow the instructions under the "Configuration" section to configure your `<script>` tag attribute values.
2022

2123
3) After you have done so, you can simply copy and paste it into your webpage!
2224

23-
# Note
25+
## Note
2426

2527
Giscus finds and links the comments to the Github Discussions by searching through and matching URLs, path names, titles, and other such metadata. If you try to change a page's title without editing the associated Github Discussion accordingly, it may lead to giscus not being able to find and link it to the Github Discussion (this is especially noticible if you set the `<script>`'s `data-strict` attribute value to `"1"`), and hence Giscus will create a new Github Discussion.
2628

_posts/2024-09-07-dark-mode.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,28 @@
22
layout: post
33
title: Dark Mode without Javascript
44
date: 2024-09-07
5-
categories: dark mode, dark theme, night mode, night theme, colour scheme, jekyll, css, github pages, static site generators, system default
5+
categories: dark mode, dark theme, night mode, night theme, colour scheme, jekyll, css, github pages, static site generators, system default theme, website, webpage, customisation
66
permalink: /dark-mode
77
---
88

9-
This guide explains why and how to easily make a dark theme for your website using CSS `@media` queries.
9+
Alternative title: System default theme for webpages
1010

11-
Alternative title: System default theme for websites
12-
13-
# Why Dark Mode
11+
## Why Dark Mode
1412

1513
For users visiting a website in a dark room at night, it would be less straining for their eyes if the webpage was displayed in a darker colour to match the environment, which is what [dark mode][dark-mode] does.
1614

1715
<img src="https://zerowidthjoiner.net/uploads/2020/04-11/light-vs-dark.png" alt="Comparison image of light theme on the left and dark theme on the right.">
1816

19-
# How to do it
17+
## How to do it
2018

2119
From [MDN Web Docs][mdn]:
2220
> The @media [CSS][css] [at-rule][at-rule] can be used to apply part of a [style sheet][style-sheet] based on the result of one or more media queries. With it, you specify a media query and a block of CSS to apply to the document if and only if the media query matches the device on which the content is being used.
2321
24-
## For Non-Static-Site-Generator Websites
22+
### For Non-Static-Site-Generator Websites
2523

2624
There is also a [video guide by Eric Murphy on Youtube][yt-vid] if you prefer to follow along with a video.
2725

28-
### External Style Sheet
26+
#### External Style Sheet
2927

3028
To separate code between HTML and CSS, link an external CSS style sheet in the `<head>` tag in the HTML document. Like so:
3129

@@ -54,7 +52,7 @@ And in your `styles.css`:
5452
}
5553
```
5654

57-
### With the \<style> HTML tag
55+
#### With the \<style> HTML tag
5856

5957
You can also type out your CSS code in between `<style>` tags if you prefer everything to be contained in one HTML document:
6058

@@ -79,7 +77,7 @@ You can also type out your CSS code in between `<style>` tags if you prefer ever
7977
</html>
8078
```
8179

82-
## For Static Site Generator Websites
80+
### For Static Site Generator Websites
8381

8482
It is a little bit less straightforward to do this with static site generators like Jekyll (which is what this website uses) or Hugo, as you have to override the theme's CSS style sheet.
8583

@@ -110,7 +108,7 @@ And you should get something like this after adding the dark mode code.
110108

111109
For other static site generator websites, you can refer to the official documentation found online for information on how to override your theme's style-sheet.
112110

113-
# Configure Giscus Theme
111+
## Configure Giscus Theme
114112

115113
To set `giscus` comments to match the website if you have done the CSS `@media` trick shown above, simply set the `<script>`'s `data-theme` attribute value to `"preferred_color_scheme"` as shown below.
116114

@@ -126,7 +124,7 @@ To set `giscus` comments to match the website if you have done the CSS `@media`
126124
</script>
127125
```
128126

129-
# Conclusion
127+
## Conclusion
130128

131129
If you found this blog post useful, leave a comment down below! Also check out how to add `giscus` comments to your own website on my [previous guide for it](/giscus-comments).
132130

_posts/2024-09-07-justify-text.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ categories: justify, text-align, jekyll, css, static site generator
66
permalink: /justify-text
77
---
88

9-
This blog guide goes into why and how to justify and hyphenate text on your website without Javascript.
9+
## For Static-Site-Generator Websites
1010

11-
# For Static-Site-Generator Websites
12-
13-
It is a little bit less straightforward to do this with static site generators like Jekyll (which is what this website uses) or Hugo, you will have to override the theme's CSS style sheet.
11+
It is a little bit less straightforward to follow this guide with static site generators like Jekyll (which is what this website also uses) or Hugo, you will have to override the theme's CSS style sheet.
1412

1513
There is a [blog post by Tom Kadwill on how to override your CSS styles in Jekyll][css-blog] you can follow to create your SCSS file, and after which you should get something resembling this:
1614

@@ -23,11 +21,11 @@ There is a [blog post by Tom Kadwill on how to override your CSS styles in Jekyl
2321

2422
After this, you can follow all the steps below the same way as it would be done if you were using CSS in a non-static-site-generator instead of SCSS in a static site generator.
2523

26-
# Why Justify Text
24+
## Why Justify Text
2725

2826
It is more of an aesthetic preference than anything. This jaggedness generally does not bother people that much because they have grown used to the popular left-aligned style of text on the web and probably do not know justification even exists on the web, only on printed books and newspapers. But it just looks better to me when all lines are the same length and the right side of text is not jagged. Justifcation is a way of acheiving that aesthetic goal without cutting words off abruptly.
2927

30-
# How to Justify
28+
## How to Justify
3129

3230
It is actually pretty simple. To justify your body text, just add this to your CSS style sheet:
3331

@@ -37,7 +35,7 @@ body {
3735
}
3836
```
3937

40-
# Why Hyphenate
38+
## Why Hyphenate
4139

4240
Text justification can make your paragraphs look tidier, but it has the side-effect of awkwardly stretching out the whitespace between words, which can create and worsen an undesirable effect commonly referred to as 'rivers of white'. This effect is known to make text harder for dyslexic readers to read, decreasing accessibility.
4341

@@ -49,7 +47,7 @@ By hyphenating, even though it does not solve the problem completely, it will re
4947

5048
Hyphenating text will cut off some words at the end of lines (indicated by an auto-inserted hyphen), but it will do it with an algorithm that tries to make it seamless.
5149

52-
# How to Hyphenate
50+
## How to Hyphenate
5351

5452
Although there is a way to hyphenate with Javascript using [Hyphenopoly.js][hyphenopoly], there already is a built-in functionality in CSS to do this and it is [widely supported by browsers](https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens).
5553

@@ -61,7 +59,7 @@ body {
6159
}
6260
```
6361

64-
# Other Blogs That Justify
62+
## Other Blogs That Justify
6563

6664
Here are a list of other blogsites that I know of that use justified text:
6765
- Chris Noxz's [noxz.tech][noxz], which renders static HTML from [`groff`][groff].
@@ -70,7 +68,7 @@ Here are a list of other blogsites that I know of that use justified text:
7068
- Public Delivery's [publicdelivery.org][pubdeliver], which also justifies without hyphens.
7169
- JPEG XL's [jpegxl.info][jpg], which had fixed its un-hyphenated text.
7270

73-
# Conclusion
71+
## Conclusion
7472

7573
f you found this blog post useful, leave a comment down below! Also read how to add reactive dark-mode to your website in my [previous blog post](/dark-mode).
7674

0 commit comments

Comments
 (0)