diff --git a/.hugo_build.lock b/.hugo_build.lock new file mode 100644 index 0000000..e69de29 diff --git a/assets/img/avatar.png b/assets/img/avatar.png index bab4bde..57c4b27 100644 Binary files a/assets/img/avatar.png and b/assets/img/avatar.png differ diff --git a/assets/jsconfig.json b/assets/jsconfig.json new file mode 100644 index 0000000..6c21798 --- /dev/null +++ b/assets/jsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": [ + "../../../tmp/hugo_cache_node/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.21.0/assets/*" + ] + } + } +} \ No newline at end of file diff --git a/config/_default/config.toml b/config/_default/config.toml index ffdf378..25269f6 100644 --- a/config/_default/config.toml +++ b/config/_default/config.toml @@ -1,8 +1,8 @@ # Change baseurl before deploy -baseurl = "https://demo.stack.jimmycai.com" +baseurl = "https://jameskent.xyz" languageCode = "en-us" paginate = 5 -title = "Hugo Theme Stack Starter" +title = "James Kent" # Theme i18n support # Available values: en, fr, id, ja, ko, pt-br, zh-cn, zh-tw, es, de, nl, it, th, el, uk, ar diff --git a/config/_default/menu.toml b/config/_default/menu.toml index 20bdb9e..53ca067 100644 --- a/config/_default/menu.toml +++ b/config/_default/menu.toml @@ -10,15 +10,7 @@ [[social]] identifier = "github" name = "GitHub" -url = "https://github.com/CaiJimmy/hugo-theme-stack" +url = "https://github.com/kentishh" [social.params] icon = "brand-github" - -[[social]] -identifier = "twitter" -name = "Twitter" -url = "https://twitter.com" - -[social.params] -icon = "brand-twitter" diff --git a/config/_default/params.toml b/config/_default/params.toml index 366020f..1cddebf 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -13,8 +13,8 @@ published = "Jan 02, 2006" lastUpdated = "Jan 02, 2006 15:04 MST" [sidebar] -emoji = "🍥" -subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." +emoji = "🖥" +subtitle = "A home for tech, hobbies, travel and coffee." [sidebar.avatar] enabled = true @@ -25,10 +25,6 @@ src = "img/avatar.png" math = false readingTime = true -[article.license] -enabled = true -default = "Licensed under CC BY-NC-SA 4.0" - ## Widgets [[widgets.homepage]] type = "search" @@ -72,78 +68,3 @@ enabled = true [imageProcessing.content] enabled = true - -## Comments -[comments] -enabled = true -provider = "disqus" - -[comments.disqusjs] -shortname = "" -apiUrl = "" -apiKey = "" -admin = "" -adminLabel = "" - -[comments.utterances] -repo = "" -issueTerm = "pathname" -label = "" - -[comments.remark42] -host = "" -site = "" -locale = "" - -[comments.vssue] -platform = "" -owner = "" -repo = "" -clientId = "" -clientSecret = "" -autoCreateIssue = false - -[comments.waline] -serverURL = "" -lang = "" -visitor = "" -avatar = "" -emoji = ["https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo"] -requiredMeta = ["name", "email", "url"] -placeholder = "" - -[comments.waline.locale] -admin = "Admin" - -[comments.twikoo] -envId = "" -region = "" -path = "" -lang = "" - -[comments.cactus] -defaultHomeserverUrl = "https://matrix.cactus.chat:8448" -serverName = "cactus.chat" -siteName = "" - -[comments.giscus] -repo = "" -repoID = "" -category = "" -categoryID = "" -mapping = "" -lightTheme = "" -darkTheme = "" -reactionsEnabled = 1 -emitMetadata = 0 - -[comments.gitalk] -owner = "" -admin = "" -repo = "" -clientID = "" -clientSecret = "" - -[comments.cusdis] -host = "" -id = "" diff --git a/content/categories/example-category/_index.md b/content/categories/example-category/_index.md deleted file mode 100644 index 678b089..0000000 --- a/content/categories/example-category/_index.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Example Category -description: A description of this category -image: - -# Badge style -style: - background: "#2a9d8f" - color: "#fff" ---- \ No newline at end of file diff --git a/content/page/links/index.md b/content/page/links/index.md deleted file mode 100644 index ef8bb3e..0000000 --- a/content/page/links/index.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Links -links: - - title: GitHub - description: GitHub is the world's largest software development platform. - website: https://github.com - image: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png -menu: - main: - weight: 4 - params: - icon: link - -comments: false ---- - -To use this feature, add `links` section to frontmatter. - -This page's frontmatter: - -```yaml -links: - - title: GitHub - description: GitHub is the world's largest software development platform. - website: https://github.com - image: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png - - title: TypeScript - description: TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. - website: https://www.typescriptlang.org - image: ts-logo-128.jpg -``` - -`image` field accepts both local and external images. \ No newline at end of file diff --git a/content/post/hello-world/cover.jpg b/content/post/hello-world/cover.jpg deleted file mode 100644 index 1634e85..0000000 Binary files a/content/post/hello-world/cover.jpg and /dev/null differ diff --git a/content/post/hello-world/index.md b/content/post/hello-world/index.md deleted file mode 100644 index 381ffff..0000000 --- a/content/post/hello-world/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Hello World -description: Welcome to Hugo Theme Stack -slug: hello-world -date: 2022-03-06 00:00:00+0000 -image: cover.jpg -categories: - - Example Category -tags: - - Example Tag -weight: 1 # You can add weight to some posts to override the default sorting (date descending) ---- - -Welcome to Hugo theme Stack. This is your first post. Edit or delete it, then start writing! - -For more information about this theme, check the documentation: https://stack.jimmycai.com/ - -Want a site like this? Check out [hugo-theme-stack-stater](https://github.com/CaiJimmy/hugo-theme-stack-starter) - -> Photo by [Pawel Czerwinski](https://unsplash.com/@pawel_czerwinski) on [Unsplash](https://unsplash.com/) \ No newline at end of file diff --git a/content/post/hugo-nginx/build-a-website-with-hugo-nginx.md b/content/post/hugo-nginx/build-a-website-with-hugo-nginx.md new file mode 100644 index 0000000..c1003d2 --- /dev/null +++ b/content/post/hugo-nginx/build-a-website-with-hugo-nginx.md @@ -0,0 +1,172 @@ +--- +title: "How I built a simple blog using Hugo and Nginx" +date: 2020-09-11T18:14:37Z +draft: false +--- + +I came across [Hugo](https://gohugo.io) recently, a ridiculously fast website framework which is perfect for setting up a simple blog, serving up static webpages (which is something I love). Two hours later, I had purchased a domain via [Namecheap](https://www.namecheap.com/), setup a Debian VPS with [Vultr](https://www.vultr.com/promo/try50/) and was ready to begin the project. + +## Installing Nginx + +Nginx is a great, open source choice to run a simple blog like this one, it's lightweight and fairly easy to get setup. Nginx is available in all major distro repositories, on a Debian you can install Nginx using apt: + +``` +$ sudo apt install nginx -y +``` + +On a Red Hat based distro, you can install Nginx using yum: + +``` +$ sudo yum install nginx -y +``` + +Once installed, start the service and confirm you can reach the default Nginx landing page by visiting your site. + +``` +$ sudo systemctl start nginx +``` + +![](https://cdn.wp.nginx.com/wp-content/uploads/2014/01/welcome-screen-e1450116630667.png) + +Looks good! If you get to this stage, your server is accepting connections to port 80. If not, check your server is listening on port 80: + +``` +$ ss -lntp | grep 80 +``` + +If you get no output, Nginx hasn't started correctly. If you get output, but you still can't hit the landing page, check your firewall is allowing connections to port 80. + +## Installing Hugo + +Hugo is a fast and modern static site generator written in Go and can be installed on just about anything. Grab the latest release from [Hugo's Github repository](https://github.com/gohugoio/hugo/releases) and run the following command: + +``` +hugo version +``` + +If you get some output, Hugo is ready to go. If you don't get any output, ensure that the Hugo binary is in your $PATH variable, this will differ based on OS. On Linux you can execute $PATH, this will print out the locations your terminal is able to run programs from. + +``` +$ $PATH +-bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +``` + +## Creating your site + +Assuming you have Hugo working as expected, you may want to create a new directory for your site contents to live in. In my case, I setup a folder in /home/ named sites, then ran the following command: + +``` +$ hugo new site sitenamehere +``` + +Hugo will go ahead and create a directory structure which looks like this: + +``` +drwxr-xr-x 2 www-data www-data 4096 Sep 10 21:00 archetypes +-rw-r--r-- 1 www-data www-data 539 Sep 15 16:49 config.toml +drwxr-xr-x 3 www-data www-data 4096 Sep 11 15:58 content +drwxr-xr-x 2 www-data www-data 4096 Sep 10 21:00 data +drwxr-xr-x 2 www-data www-data 4096 Sep 10 21:00 layouts +drwxr-xr-x 6 root root 4096 Aug 30 1754 public +drwxr-xr-x 3 www-data www-data 4096 Sep 10 21:05 resources +drwxr-xr-x 2 www-data www-data 4096 Sep 15 17:01 static +drwxr-xr-x 3 www-data www-data 4096 Sep 10 21:02 themes +``` + +To find out a bit more about how this all ties into your site generation, check the [Hugo documentation.](https://gohugo.io/documentation/) + +## Adding a theme to Hugo + +Hugo has a great collection of [themes](https://themes.gohugo.io/) on their website to choose from, I chose the [hello-friend-ng](https://themes.gohugo.io/hugo-theme-hello-friend-ng/) for my blog. Follow the instructions to download your theme of choice and save the theme into your themes/ folder in your sites contents. Finally, add the theme name to your config.toml file in the root of your site contents: + +``` +baseURL = "https://jameskent.xyz" +languageCode = "en-us" +title = "James Kent" +theme = "hello-friend-ng" +paginate = 10 +``` + +## Creating a post + +Now for the actual content. Run the following command to create a new post: + +``` +$ hugo new posts/my-first-post.md +``` + +Hugo will create a new post named my-first-post in your content/posts folder. Make all of the edits to this file you would like to make, then save your changes. + +## Generating your site + +After all of these changes to your site, adding your theme and creating your first post you should generate your site. This is the real power behind Hugo, simply change directory into your site folder, and run: + +``` +$ hugo + + | EN +-------------------+----- + Pages | 7 + Paginator pages | 0 + Non-page files | 0 + Static files | 13 + Processed images | 0 + Aliases | 2 + Sitemaps | 1 + Cleaned | 0 + +Total in 98 ms +``` + +## Configuring Nginx + +You should have Nginx installed at this point, if not, refer back to the first section of this article for instruction. + +We need write out a configuration file, so Nginx knows what content to serve to users visiting your site. Luckily for us, Nginx installs with a default site configuration file which we can copy and use for our site: + +``` +$ cd /etc/nginx/sites-available +$ cp default nameofmysite +``` + +Now we have a copy of the default configuration file, open your site file in your favourite text editor. A lot of this file is taken up by comments, without comments, your site config should look something like this: + +``` +server { + listen 80; # Tells nginx which port to listen on for incoming connections. + listen [::]:80; # + + server_name mysite.com www.mysite.com; # Enter your site name here. + + root /home/username/mysite/public/; # Enter the full path to your Hugo site here. + index index.html; + + location / { + try_files $uri $uri/ =404; + } +} +``` + +To enable the site, add a symlink from your site's location into the /etc/nginx/sites-enabled: + +``` +$ sudo ln -s /etc/nginx/sites-available/mysitename /etc/nginx/sites-enabled/mysitename +``` + +Finally, enable and restart the Nginx service: + +``` +$ sudo systemctl enable nginx +$ sudo systemctl restart nginx +``` + +## Adding SSL to your site + +Adding SSL to your site has never been easier and best of all, it's completely free! There are a myriad of reasons to add SSL to your site which I won't go into detail in, in this blog post. Just do it. + + +Visit the [certbot](https://certbot.eff.org/) site to get detailed instructions for installing on your OS and web server of choice. + +## Conclusion + +Assuming you ran through this article without any errors, your site should be up and running! Hugo is a fantastic project and I have had a great time so far getting it installed and setup. diff --git a/content/post/image-gallery/1.jpg b/content/post/image-gallery/1.jpg deleted file mode 100644 index 3f1f905..0000000 Binary files a/content/post/image-gallery/1.jpg and /dev/null differ diff --git a/content/post/image-gallery/2.jpg b/content/post/image-gallery/2.jpg deleted file mode 100644 index d19214e..0000000 Binary files a/content/post/image-gallery/2.jpg and /dev/null differ diff --git a/content/post/image-gallery/index.md b/content/post/image-gallery/index.md deleted file mode 100644 index 94bc377..0000000 --- a/content/post/image-gallery/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: Image gallery -description: Create beautiful interactive image gallery using Markdown -date: 2023-08-26 00:00:00+0000 -image: 2.jpg ---- - -Hugo theme Stack supports the creation of interactive image galleries using Markdown. It's powered by [PhotoSwipe](https://photoswipe.com/) and its syntax was inspired by [Typlog](https://typlog.com/). - -To use this feature, the image must be in the same directory as the Markdown file, as it uses Hugo's page bundle feature to read the dimensions of the image. **External images are not supported.** - -## Syntax - -```markdown -![Image 1](1.jpg) ![Image 2](2.jpg) -``` - -## Result - -![Image 1](1.jpg) ![Image 2](2.jpg) - -> Photo by [mymind](https://unsplash.com/@mymind) and [Luke Chesser](https://unsplash.com/@lukechesser) on [Unsplash](https://unsplash.com/) \ No newline at end of file diff --git a/content/post/markdown-syntax/index.md b/content/post/markdown-syntax/index.md deleted file mode 100644 index e004892..0000000 --- a/content/post/markdown-syntax/index.md +++ /dev/null @@ -1,150 +0,0 @@ ---- -title: Markdown Syntax Guide -date: 2023-09-07 -description: Sample article showcasing basic Markdown syntax and formatting for HTML elements. -tags: - - markdown - - css - - html - - themes -categories: - - themes - - syntax ---- - -This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. - - - -## Headings - -The following HTML `
Test
- - -``` - -### Code block indented with four spaces - - - - - -Test
- - - -### Diff code block - -```diff -[dependencies.bevy] -git = "https://github.com/bevyengine/bevy" -rev = "11f52b8c72fc3a568e8bb4a4cd1f3eb025ac2e13" -- features = ["dynamic"] -+ features = ["jpeg", "dynamic"] -``` - -### One line code block - -```html -A paragraph
-``` - -## List Types - -### Ordered List - -1. First item -2. Second item -3. Third item - -### Unordered List - -* List item -* Another item -* And another item - -### Nested list - -* Fruit - * Apple - * Orange - * Banana -* Dairy - * Milk - * Cheese - -## Other Elements — abbr, sub, sup, kbd, mark - -GIF is a bitmap image format. - -H2O - -Xn + Yn = Zn - -Press CTRL + ALT + Delete to end the session. - -Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures. \ No newline at end of file diff --git a/content/post/math-typesetting/index.md b/content/post/math-typesetting/index.md deleted file mode 100644 index d206914..0000000 --- a/content/post/math-typesetting/index.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Math Typesetting -description: Math typesetting using KaTeX -date: 2023-08-24 00:00:00+0000 -math: true ---- - -Stack has built-in support for math typesetting using [KaTeX](https://katex.org/). - -**It's not enabled by default side-wide,** but you can enable it for individual posts by adding `math: true` to the front matter. Or you can enable it side-wide by adding `math = true` to the `params.article` section in `config.toml`. - -## Inline math - -This is an inline mathematical expression: $\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…$ - -```markdown -$\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…$ -``` - -## Block math - -$$ - \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } -$$ - -```markdown -$$ - \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } -$$ -``` - -$$ - f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi -$$ - -```markdown -$$ - f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi -$$ -``` \ No newline at end of file diff --git a/content/post/new-beginnings/new-beginnings.md b/content/post/new-beginnings/new-beginnings.md new file mode 100644 index 0000000..4468e4c --- /dev/null +++ b/content/post/new-beginnings/new-beginnings.md @@ -0,0 +1,14 @@ +--- +title: "New beginnings" +date: 2023-11-13T02:50:13Z +draft: false +--- +Firstly, it's been three years since my last update to this blog. Whilst this was mainly a learning exercise for myself, as well as having my own little corner on the web, I thought now would be a good time to start making semi-regular posts here as I now have quite a lot of time on my hands. + +Back in October my girlfriend and I quit our jobs, moved out of London and started an exciting journey traveling South America. Whilst this is something both of us have wanted to do for a while, actually doing it is something else entirely. We are both extremely happy that we bucked up the courage to get on with it and start researching, planning and inevitably booking our flight out of Heathrow and starting our adventure in Lima, Peru. At the time of writing this, we've been in Peru for around five weeks, our next stop being Colombia. + +I'll be posting country summaries as we go which will include route information, recommendations and anything else that might be worth mentioning. + +Cheers! + + diff --git a/content/post/pibound/pi-bound.png b/content/post/pibound/pi-bound.png new file mode 100644 index 0000000..e452214 Binary files /dev/null and b/content/post/pibound/pi-bound.png differ diff --git a/content/post/pibound/pibound.md b/content/post/pibound/pibound.md new file mode 100644 index 0000000..2fde0ec --- /dev/null +++ b/content/post/pibound/pibound.md @@ -0,0 +1,62 @@ +--- +title: "PiBound - a simple script which configures PiHole and Unbound to be your network's recursive DNS server." +date: 2020-10-09T13:26:43Z +draft: false +--- + +![https://github.com/kentishh/pi-bound](pi-bound.png) + +[PiBound](https://github.com/kentishh/pi-bound) is a project built out of love for PiHole and privacy. I wanted to make it as simple as possible to install PiHole and make use of Unbound to be your network's recursive DNS server. Moving away from using your ISP's, Google's or Cloudflare's DNS service is a great way to reduce the amount of eyes that can potentially monitor your internet usage and browsing habits. When we use Unbound as our DNS server, you eliminate the upstream DNS service, becoming your own DNS provider. + + +## What is PiHole? + +[PiHole](https://pi-hole.net) is an open source network DNS sink-hole, blocking any blacklisted domains before they reach your device. This is especially effective when running on a slower broadband connection, preventing any requests out to known tracking, advertisement or malicious sites can help preserve bandwidth noticeably. I've found over the years that pairing PiHole with a browser extension such as [uBlock origin](https://github.com/gorhill/uBlock) is a great combination that will pretty much block any annoyances when browsing the web. With this configuration, you get the benefits of blocking domains before they even hit your network and any that do get past PiHole will typically be picked up by uBlock and blocked. + +## What is Unbound? + +[Unbound](https://nlnetlabs.nl/projects/unbound/about/) is a validating, caching, recursive DNS server. It's lightweight enough to run on a Pi-Zero, which is perfect for a project like this. We'll be utilising Unbound to do our DNS recursion as well as it's caching abilities, which will store a local cache of DNS records which can be served to the client immediately. To learn a little bit more about DNS, [take a look at this fun comic](https://howdns.works). + +## How does the script work? + +Initially you will be prompted for the installation type you want to continue with, a lot of people that have used this script already have PiHole installed, so I added the functionality to just install Unbound and complete all necessary configuration. + +* Firstly, the script will install PiHole, using the automated installation script method provided by the PiHole developers. +* Secondly, Unbound will be installed, root hints will be downloaded and the required Unbound configuration file will be pulled from the project's GitHub repository. PiHole will be configured to use Unbound as our DNS server. +* Finally, a few DNS checks will take place to ensure DNSSEC is configured and Unbound is working as expected. + +### Comparing our own DNS server's performance to public resolvers. + +In my testing, I've found for the most part that using my own DNS server has surprisingly been just as fast as using a public resolver such as Google (8.8.8.8), or Cloudflare (1.1.1.1). + +See the dig output below when querying *google.com* from Google's DNS servers: + +``` +$ dig google.com @8.8.8.8 | grep "Query" +;; Query time: 10 msec +``` + +Compare this to querying *google.com* using my PiBound server: + +``` +$ dig google.com @192.168.1.110 | grep "Query" +;; Query time: 2 msec +``` + +We can assume some caching is happening here on my DNS server. Let's try to query a site outside of my cache: + +``` +dig networkchuck.coffee @192.168.1.110 | grep "Query" +;; Query time: 182 msec +``` + +Comparing this to Google's DNS: + +``` +dig networkchuck.coffee @8.8.8.8 | grep "Query" +;; Query time: 142 msec +``` + +These query time differences are negligable and will not have a noticeable impact on general performance. + + diff --git a/content/post/shortcodes/cover.jpg b/content/post/shortcodes/cover.jpg deleted file mode 100644 index 3bdd200..0000000 Binary files a/content/post/shortcodes/cover.jpg and /dev/null differ diff --git a/content/post/shortcodes/index.md b/content/post/shortcodes/index.md deleted file mode 100644 index 72d8166..0000000 --- a/content/post/shortcodes/index.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Shortcodes -description: Useful shortcodes that can be used in Markdown -date: 2023-08-25 00:00:00+0000 -image: cover.jpg ---- - -For more details, check out the [documentation](https://stack.jimmycai.com/writing/shortcodes). - -## Bilibili video - -{{< bilibili "BV1d4411N7zD" >}} - -## Tencent video - -{{< tencent "g0014r3khdw" >}} - -## YouTube video - -{{< youtube "0qwALOOvUik" >}} - -## Generic video file - -{{< video "https://www.w3schools.com/tags/movie.mp4" >}} - -## Gist - -{{< gist CaiJimmy e2751a943de10b2a5b3a8a6c2120cb86 >}} - -## GitLab - -{{< gitlab 2589724 >}} - -## Quote - -{{< quote author="A famous person" source="The book they wrote" url="https://en.wikipedia.org/wiki/Book">}} -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -{{< /quote >}} - ------ - -> Photo by [Codioful](https://unsplash.com/@codioful) on [Unsplash](https://unsplash.com/photos/WDSN62Qdxuk) \ No newline at end of file