diff options
Diffstat (limited to 'build/berg')
-rw-r--r-- | build/berg/index.html | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/build/berg/index.html b/build/berg/index.html index a761347..f60b2cb 100644 --- a/build/berg/index.html +++ b/build/berg/index.html @@ -3,11 +3,12 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="color-scheme" content="dark light"> <link rel="icon" href="data:,"> <title>Hosting with Codeberg Pages</title> <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" /> <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" /> -<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style> +<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style> </head> <nav> @@ -16,68 +17,40 @@ <main> <h1 id="hosting-with-codeberg-pages">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 id="create-the-repos">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 id="configuration-edits">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 id="the-submodule">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 id="the-workflow">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 id="custom-domains-optional">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> |