diff options
Diffstat (limited to 'build/berg')
-rw-r--r-- | build/berg/index.html | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/build/berg/index.html b/build/berg/index.html new file mode 100644 index 0000000..f00560b --- /dev/null +++ b/build/berg/index.html @@ -0,0 +1,73 @@ +<!doctype html> +<html lang="en" id="top"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" href="data:,"> + <title>Hosting with Codeberg Pages</title> + <link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" /> + <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style> +</head> + +<nav> + <a href="#menu">Menu ↓</a> +</nav> + +<main> +<h1>Hosting with Codeberg Pages</h1> +<p>2022-07-29</p> +<p>I recently switched the <a href="https://pblog.bt.ht">pblog</a> project repo over from Sourcehut to Codeberg (mostly for UX reasons) and it got me looking into <a href="https://codeberg.page">Codeberg Pages</a>. It seemed like a cleaner approach to host my personal blog on the same platform I planned to also share the source code.</p> +<p>I decided to share the setup process here since I couldn't find a straightforward guide explaining everything required to get going. So, let's dig in.</p> +<h2>Create the Repos</h2> +<p><strong>Disclaimer</strong>: My personal blog uses <a href="https://pblog.bt.ht">pblog</a>, so although these instructions will be catered towards that SSG the same concept <em>should</em> apply for any other generator (Jekyll, Hugo, Next, etc.).</p> +<p>The first step is to create the main repo that would house the core files of <code>pblog</code>. Then we need to make a separate repo simply called <code>pages</code>. This second project is where all the generated "static" files get rendered.</p> +<p><em>Side note</em>: Be sure to at least include a <code>README</code> file in that <code>pages</code> repo. This will avoid any errors or warnings when setting up our submodules in the next steps.</p> +<h2>Configuration Edits</h2> +<p>Once your two repos are created, you will need to make some minor edits to the <code>_config.sh</code> in the core <code>pblog</code> project to tell the build script where the generated files should go (in this case the <code>pages</code> repo):</p> +<pre><code>OUTPUT="_output/pages/" +</code></pre> +<h2>The Submodule</h2> +<p>Using terminal, navigate to the <code>_output/</code> directory in your core <code>pblog</code> project. Run the following, remembering to replace the USERNAME parameter with your own:</p> +<pre><code>git submodule add git@codeberg.org:USERNAME/pages.git +</code></pre> +<p>If everything worked correctly you should now have a <code>.gitmodules</code> file in your main <code>pblog</code> project. If you get any errors, you might need to include the name of the directory at the end of the command:</p> +<pre><code>git submodule add git@codeberg.org:USERNAME/pages.git pages +</code></pre> +<h2>The Workflow</h2> +<p>Now you can make changes, add new posts and pages in the main <code>pblog</code> project and have those generated files render into your other <code>pages</code> repo. For this workflow, I simply push commits to both projects when I am happy with my changes but I'm sure you could look into automating this process (ie. a single push from the <code>pblog</code> repo forces a the <code>pages</code> repo to also update).</p> +<p>Now you can navigate to the standard Codeberg Pages URL to see it in action:</p> +<pre><code>USERNAME.codeberg.page +</code></pre> +<p>If you want to use your own custom domain (who doesn't?) then continue reading.</p> +<h2>Custom Domains (Optional)</h2> +<p>The first thing you will need to do is add a <code>.domains</code> file to your <code>pages</code> root directory. In this file you will want to list your custom domain on the first line, followed by the standard Codeberg pages URL below it. Like so:</p> +<pre><code>yourcustomdomain.com +USERNAME.codeberg.page +</code></pre> +<p>I'm keeping this very basic, but I suggest you look further into the <a href="https://docs.codeberg.org/codeberg-pages/#custom-domains">official documentation</a> if there are any extra settings you'd like to tinker with.</p> +<p>The final step is configuring a <code>CNAME</code> DNS setting through your registrar:</p> +<pre><code>@ -> USERNAME.codeberg.page +</code></pre> +<p>Give the DNS settings a bit of time to take (24-48 hours) and you'll have your custom domain working just fine.</p> +<p>Happy hosting!</p> +<footer role="contentinfo"> + <h2>Menu Navigation</h2> + <ul id="menu"> + <li><a href="/">Home</a></li> + <li><a href="/projects">Projects</a></li> + <li><a href="/uses">Uses</a></li> + <li><a href="/wiki">Wiki</a></li> + <li><a href="/resume">Resume</a></li> + <li><a href="/colophon">Colophon</a></li> + <li><a href="/now">Now</a></li> + <li><a href="/donate">Donate</a></li> + <li><a href="/atom.xml">RSS</a></li> + <li><a href="#top">↑ Top of the page</a></li> + </ul> + <small> + Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br> + Maintained with ♥ for the web. <br> + Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> & <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br> + The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>. + </small> +</footer>
\ No newline at end of file |