From 13cec3d0fc257d0e65c9a1c06bfc71648722a506 Mon Sep 17 00:00:00 2001 From: Bradley Taunt Date: Fri, 2 Feb 2024 13:05:54 -0500 Subject: Initial commit for cgit platform --- _site/atom.xml | 183 ++++++++++++++++++++++++++++++++++++++++ _site/index.html | 251 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 434 insertions(+) create mode 100644 _site/atom.xml create mode 100644 _site/index.html (limited to '_site') diff --git a/_site/atom.xml b/_site/atom.xml new file mode 100644 index 0000000..9bc9ffe --- /dev/null +++ b/_site/atom.xml @@ -0,0 +1,183 @@ + + + PHPetite + + + 2024-02-02T18:05:24+00:00 + https://phpetite.btxx.org/ + + Bradley Taunt + bt@btxx.org + + + Cleaning Things Up & Future PHPetite Updates + + 2022-06-28T00:00:00+00:00 + https://phpetite.btxx.org/#2022-06-28-cleaning-things-up-future-phpetite-updates + <h1>Cleaning Things Up &amp; Future PHPetite Updates</h1> +<p>It has been quite a long time since I've reviewed or updated this little project of mine. Since it's release, I've created another minimal blogging system (based on <code>bash</code> this time) called <a href="https://shinobi.website">Shinobi</a> and converted my personal website to use <em>that</em> instead.</p> +<p>But I still love this single file blogging concept. So, I thought it was time for some basic cleanup. That "cleanup" slowly turned into a TODO list of sorts and now there are extra features I plan to add.</p> +<h2>The Cleanup</h2> +<p>* I first started by including the specific <code>$_SERVER['DOCUMENT_ROOT'].</code> parameter in the main PHP includes. I noticed when pulling the project in a "fresh" instance that the build failed without this setup. Sorry for anyone who may have ran into this issue previously!</p> +<p>* The default build script has been moved into a proper <code>makefile</code>. Now, generating the website only requires you to run <code>make</code> from the main directory. Running <code>make serve</code> builds the website and also runs a local server for testing at <code>localhost:8000</code>. Nothing groundbreaking but pretty helpful.</p> +<p>* The original dark mode CSS styling has been removed in favor of using the browser supported <code>color scheme</code> meta tag.</p> +<p>* Post dates are now listed at the top of each blog article (see above for reference)</p> +<h2>What's to Come</h2> +<p>I keep a running list of features I plan to implement (in no particular order) on the main <a href="#about">about section</a>. Feel free to open an issue on the <a href="https://todo.sr.ht/~bt/phpetite">official sourcehut todo</a> if you have other features and suggestions. Don't be shy!</p> +<h2>Follow Along</h2> +<p>Rolling out any new updates for this project will take time. I'm in no <em>real</em> rush and I do have other projects that require my attention. That said, if you wish to stay up-to-date, I recommend following along via the <a href="/atom.xml">official RSS feed</a>.</p> +<p>Thanks for reading and happy single-file blogging!</p> +<p>-- Brad</p> + + + + Converting Custom Fonts to Base64 Strings + + 2021-02-27T00:00:00+00:00 + https://phpetite.btxx.org/#2021-02-27-converting-custom-fonts-to-base64-strings + <h1>Converting Custom Fonts to Base64 Strings</h1> +<p>There are currently no plans to automatically convert custom fonts to base64 strings within the project itself - <strong>but</strong> it is very easy to do so manually for Mac/Linux users.</p> +<p>Simply open a terminal window and navigate to where your custom font file is located. The enter the following command (replacing the font extension name with your appropriate file name):</p> +<pre><code class="bash">base64 your-custom-font.woff2 &gt; font-base64.txt</code></pre> +<p>Then in your <code>style.css</code> file, add the custom font as you normally would via the <code>@font-face</code> property but this time utilizing base64:</p> +<pre><code class="css">@font-face { + font-family: 'FontName; + src: url(data:font/woff2;base64,[BASE64 CODE]) format('woff2'); +}</code></pre> +<h2>Things to Keep in Mind</h2> +<p>Remember that by using base64 strings you are <em>significantly</em> increasing the overall size of your single file project. This should be used for extreme use cases where a single file website/blog isn't allowed access to 3rd party URLs or extra files on the root server. Hence why by default it isn't include in the PHPetite project itself.</p> +<h2>Live Example</h2> +<p>You can check out the <a href="https://thrifty.name">ThriftyName</a> project (built on PHPetite) to see base64 custom fonts in use.</p> + + + + Disable Image to Base64 Conversion + + 2021-02-18T00:00:00+00:00 + https://phpetite.btxx.org/#2021-02-18-disable-image-to-base64-conversion + <h1>Disable Image to Base64 Conversion</h1> +<p>Some users<sup><a href="#" class="footnote-ref">2</a></sup> may wish to host their imagery and media via a 3rd party source or simply want to avoid the heavy weight added with using base64 strings (~133%+ in size). </p> +<p>To disable this feature, open your <code>_phpetite/_config.php</code> file and change the <code>images_to_base64</code> variable to false.</p> +<pre><code class="php">// Activate or disable images to base64 strings +$images_to_base64 = false;</code></pre> +<div class="footnotes"> +<hr /> +<ol> +<li> +<p>Thanks to <a href="https://news.ycombinator.com/user?id=Minor49er">Minor49er</a> for suggesting this option on <a href="https://news.ycombinator.com/item?id=26175904">Hacker News</a>&#160;<a href="#" class="footnote-backref">&#8617;</a></p> +</li> +</ol> +</div> + + + + Automatic RSS + + 2021-02-08T00:00:00+00:00 + https://phpetite.btxx.org/#2021-02-08-automatic-rss + <h1>Automatic RSS</h1> +<p>PHPetite ships with a very basic and crude auto-generated RSS feed. When you run the project's build script:</p> +<pre><code class="bash">bash build.sh</code></pre> +<p>it not only generates the single HTML blog file, but also creates an <code>atom.xml</code> file in the root directory. Simply share this with your followers or link it somewhere on your site itself (eg. <code>yourdomain.com/atom.xml</code>).</p> +<p>You can view this site's RSS feed here: </p> +<p><a href="https://phpetite.org/atom.xml">https://phpetite.org/atom.xml</a></p> + + + + The Benefits of a Single File Blog + + 2021-02-07T00:00:00+00:00 + https://phpetite.btxx.org/#2021-02-07-the-benefits-of-a-single-file-blog + <h1>The Benefits of a Single File Blog</h1> +<p>Rendering your blog or website as a single file using PHPetite is pretty fantastic. It gives you the freedom to easily share, host or edit your site's content on almost any hosting provider. </p> +<p>Since the entire blog's content is generated inline on <code>build</code>, you don't need to fiddle around with external <code>CSS</code> and <code>JS</code> files. There is also no need to worry about broken <code>img</code> sources since PHPetite converts all images into proper base64 strings.</p> +<p>Using this website as an example: this blog weighs in at <strong>~21KB</strong><sup><a href="#" class="footnote-ref">2</a></sup>. </p> +<p>That is incredibly tiny in terms of website size. Some sections on other web pages are larger than that!</p> +<p>The portability of having a <em>single</em> <code>HTML</code> file as your blog is quite liberating. Though it should be noted, if your blog consists of high resolutions imagery or includes massive amounts of content, a single file might be a little impractical for you.</p> +<h2>Hosting for Newcomers</h2> +<p>I suggest using <a href="https://app.netlify.com/drop">Netlify Drop</a> if this is your first time setting up a hosting environment or you don't consider yourself too tech-savvy. Once you have your rendered <code>index.html</code> file, simply drag-and-drop the file into Netlify Drop - that's it!</p> +<p>From there you can always setup a permanent subdomain or use your own custom domain.</p> +<h2>Local Development</h2> +<p>Simply follow the instructions found on the <a href="#generating-this-blog">Generating This Blog</a> page and you'll be running a local version of your site in seconds.</p> +<div class="footnotes"> +<hr /> +<ol> +<li> +<p>At this time of writing (Feb 2021)&#160;<a href="#" class="footnote-backref">&#8617;</a></p> +</li> +</ol> +</div> + + + + Converting from Jekyll + + 2021-02-06T00:00:00+00:00 + https://phpetite.btxx.org/#2021-02-06-converting-from-jekyll + <h1>Converting from Jekyll</h1> +<p>This walkthrough is still being tweaked and optimized. Check back soon for the final version!</p> + + + + Markdown examples + + 2021-01-09T00:00:00+00:00 + https://phpetite.btxx.org/#2021-01-09-markdown-examples + <h1><abbr title="Markdown is a lightweight markup language for creating formatted text using a plain-text editor">Markdown</abbr> examples</h1> +<p>On top of plain <abbr title="Markdown is a lightweight markup language for creating formatted text using a plain-text editor">Markdown</abbr>, <a href="https://michelf.ca/projects/php-markdown/extra"><abbr title="Markdown is a lightweight markup language for creating formatted text using a plain-text editor">Markdown</abbr> Extra</a> adds support for footnotes, abbreviations, definition lists, tables, <code>class</code> and <code>id</code> attributes, fenced code blocks, and <abbr title="Markdown is a lightweight markup language for creating formatted text using a plain-text editor">Markdown</abbr> inside <abbr title="Hypertext Markup Language">HTML</abbr> blocks.</p> +<p>Additionally, images are properly enclosed in figure elements (with optional figcaption), and the <code>loading="lazy"</code> attribute is added.</p> +<hr /> +<p>This is <strong>bold</strong>, <em>italic</em>, this is an <a href="#2021-01-11-hello-world">internal link</a>, this is <del>not</del> <code>code</code>, press <kbd>alt</kbd>.</p> +<figure><img src="content/img/image.png" alt="This is the image alt text" title="This is the image title." width="1280" height="800" loading="lazy" /><figcaption>This is the image caption (line begins with a space). The image above is actually a rendered base64 encoding.</figcaption> +</figure> +<blockquote> +<p>This text is in a blockquote.</p> +</blockquote> +<h2>This is a level 2 heading</h2> +<h3>This is a level 3 heading</h3> +<ul> +<li>This</li> +<li>is</li> +<li>a list</li> +</ul> +<ol start="0"> +<li>This</li> +<li>is</li> +<li>an</li> +<li>ordered list</li> +</ol> +<pre><code class="txt">This is + preformatted + text.</code></pre> +<table> +<thead> +<tr> +<th>this is a table</th> +<th>header</th> +<th style="text-align: right;">this column is right-aligned</th> +</tr> +</thead> +<tbody> +<tr> +<td>these</td> +<td>content</td> +<td style="text-align: right;">1234</td> +</tr> +<tr> +<td>are</td> +<td>cells</td> +<td style="text-align: right;">56789</td> +</tr> +</tbody> +</table> +<p>This sentence has a footnote.<sup><a href="#" class="footnote-ref">2</a></sup></p> +<div class="footnotes"> +<hr /> +<ol> +<li> +<p>This is a footnote&#160;<a href="#" class="footnote-backref">&#8617;</a></p> +</li> +</ol> +</div> + + \ No newline at end of file diff --git a/_site/index.html b/_site/index.html new file mode 100644 index 0000000..c286c76 --- /dev/null +++ b/_site/index.html @@ -0,0 +1,251 @@ + + + + + + PHPetite + + + + + + + + + + + +
+

+ PHPetite +

+
+
+

Cleaning Things Up & Future PHPetite Updates

+

It has been quite a long time since I've reviewed or updated this little project of mine. Since it's release, I've created another minimal blogging system (based on bash this time) called Shinobi and converted my personal website to use that instead.

+

But I still love this single file blogging concept. So, I thought it was time for some basic cleanup. That "cleanup" slowly turned into a TODO list of sorts and now there are extra features I plan to add.

+

The Cleanup

+

* I first started by including the specific $_SERVER['DOCUMENT_ROOT']. parameter in the main PHP includes. I noticed when pulling the project in a "fresh" instance that the build failed without this setup. Sorry for anyone who may have ran into this issue previously!

+

* The default build script has been moved into a proper makefile. Now, generating the website only requires you to run make from the main directory. Running make serve builds the website and also runs a local server for testing at localhost:8000. Nothing groundbreaking but pretty helpful.

+

* The original dark mode CSS styling has been removed in favor of using the browser supported color scheme meta tag.

+

* Post dates are now listed at the top of each blog article (see above for reference)

+

What's to Come

+

I keep a running list of features I plan to implement (in no particular order) on the main about section. Feel free to open an issue on the official sourcehut todo if you have other features and suggestions. Don't be shy!

+

Follow Along

+

Rolling out any new updates for this project will take time. I'm in no real rush and I do have other projects that require my attention. That said, if you wish to stay up-to-date, I recommend following along via the official RSS feed.

+

Thanks for reading and happy single-file blogging!

+

-- Brad


Converting Custom Fonts to Base64 Strings

+

There are currently no plans to automatically convert custom fonts to base64 strings within the project itself - but it is very easy to do so manually for Mac/Linux users.

+

Simply open a terminal window and navigate to where your custom font file is located. The enter the following command (replacing the font extension name with your appropriate file name):

+
base64 your-custom-font.woff2 > font-base64.txt
+

Then in your style.css file, add the custom font as you normally would via the @font-face property but this time utilizing base64:

+
@font-face {
+    font-family: 'FontName;
+    src: url(data:font/woff2;base64,[BASE64 CODE]) format('woff2');
+}
+

Things to Keep in Mind

+

Remember that by using base64 strings you are significantly increasing the overall size of your single file project. This should be used for extreme use cases where a single file website/blog isn't allowed access to 3rd party URLs or extra files on the root server. Hence why by default it isn't include in the PHPetite project itself.

+

Live Example

+

You can check out the ThriftyName project (built on PHPetite) to see base64 custom fonts in use.


Disable Image to Base64 Conversion

+

Some users1 may wish to host their imagery and media via a 3rd party source or simply want to avoid the heavy weight added with using base64 strings (~133%+ in size).

+

To disable this feature, open your _phpetite/_config.php file and change the images_to_base64 variable to false.

+
// Activate or disable images to base64 strings
+$images_to_base64 = false;
+
+
+
    +
  1. +

    Thanks to Minor49er for suggesting this option on Hacker News 

    +
  2. +
+

Automatic RSS

+

PHPetite ships with a very basic and crude auto-generated RSS feed. When you run the project's build script:

+
bash build.sh
+

it not only generates the single HTML blog file, but also creates an atom.xml file in the root directory. Simply share this with your followers or link it somewhere on your site itself (eg. yourdomain.com/atom.xml).

+

You can view this site's RSS feed here:

+

https://phpetite.org/atom.xml


The Benefits of a Single File Blog

+

Rendering your blog or website as a single file using PHPetite is pretty fantastic. It gives you the freedom to easily share, host or edit your site's content on almost any hosting provider.

+

Since the entire blog's content is generated inline on build, you don't need to fiddle around with external CSS and JS files. There is also no need to worry about broken img sources since PHPetite converts all images into proper base64 strings.

+

Using this website as an example: this blog weighs in at ~21KB1.

+

That is incredibly tiny in terms of website size. Some sections on other web pages are larger than that!

+

The portability of having a single HTML file as your blog is quite liberating. Though it should be noted, if your blog consists of high resolutions imagery or includes massive amounts of content, a single file might be a little impractical for you.

+

Hosting for Newcomers

+

I suggest using Netlify Drop if this is your first time setting up a hosting environment or you don't consider yourself too tech-savvy. Once you have your rendered index.html file, simply drag-and-drop the file into Netlify Drop - that's it!

+

From there you can always setup a permanent subdomain or use your own custom domain.

+

Local Development

+

Simply follow the instructions found on the Generating This Blog page and you'll be running a local version of your site in seconds.

+
+
+
    +
  1. +

    At this time of writing (Feb 2021) 

    +
  2. +
+

Converting from Jekyll

+

This walkthrough is still being tweaked and optimized. Check back soon for the final version!


Markdown examples

+

On top of plain Markdown, Markdown Extra adds support for footnotes, abbreviations, definition lists, tables, class and id attributes, fenced code blocks, and Markdown inside HTML blocks.

+

Additionally, images are properly enclosed in figure elements (with optional figcaption), and the loading="lazy" attribute is added.

+
+

This is bold, italic, this is an internal link, this is not code, press alt.

+
This is the image alt text
This is the image caption (line begins with a space). The image above is actually a rendered base64 encoding.
+
+
+

This text is in a blockquote.

+
+

This is a level 2 heading

+

This is a level 3 heading

+
    +
  • This
  • +
  • is
  • +
  • a list
  • +
+
    +
  1. This
  2. +
  3. is
  4. +
  5. an
  6. +
  7. ordered list
  8. +
+
This is
+    preformatted
+  text.
+ + + + + + + + + + + + + + + + + + + + +
this is a tableheaderthis column is right-aligned
thesecontent1234
arecells56789
+

This sentence has a footnote.1

+
+
+
    +
  1. +

    This is a footnote 

    +
  2. +
+

+

Structuring Blog Posts

+

Blog posts should be placed into the /content directory and be named based only on their post date. See an example here:

+
2048-01-01.md
+

PHPetite will create a target by appending the page title inside the article to the file's date name. So a markdown file with the following content:

+
# Bladerunner Rocks
+
+Bladerunner is amazing because blah blah blah...
+

will render out the target link as:

+
example.com/#2048-01-01-bladerunner-rocks

Requirements

+
    +
  1. PHP 7.3 or higher
  2. +
  3. If using Linux, you will require the following packages in order to convert your images to base64 encoding:
      +
    • PHP XML -> sudo apt-get install php-xml
    • +
    • PHP mbstring -> sudo apt-get install php-mbstring
    • +
    +
  4. +
+

That's really it!

Generating This Blog

+

Important: Before building and uploading your single file blog, be sure to edit all the proper details found inside the _phpetite/_config.php file. This includes your domain, site title, author name, etc.

+

Most users won't ever need to fiddle with the other files inside the _phpetite directory.

+
+

Get PHPetite in order to convert a collection of Markdown files into a single HTML file with inline CSS.

+
    +
  1. Make proper edits to the /_phpetite/_config.php file
  2. +
  3. Write posts in /content
  4. +
  5. (Optional) include any images under the /content/img/ directory
  6. +
  7. From the command-line run:
  8. +
+
make
+

This will generate both the single file HTML page, along with an atom.xml file for the use of an optional RSS feed.

+

These two files are output into the _site directory.

+

Looking for more advanced options?

+

Adding Custom Pages

+

To add your own custom pages, simply create a Markdown file under the content/_pages directory. PHPetite will take it from there!

+

Some Caveats

+

Any page you create will be automatically added to the footer navigation section. If you wish to hide individual pages from showing in the footer, do so via CSS:

+
footer a.slug-name-of-your-page {
+    display: none;
+}
+

If you want to remove the footer navigation altogether, add the following to your style.css file:

+
footer .footer-links {
+    display: none;
+}

About PHPetite

+

This entire website is a single HTML file. It was generated by PHPetite.

+

If you notice any issues or want to help make this project even better, check it out on cgit.

+

Feature Wishlist

+

☐ Implement a "watch" system for local development (auto-rebuilds)
+☐ Detailed documentation for converting existing static sites to PHPetite
+☐ More theme / styling options!
+☐ Proper accessibility audit
+☑ Allow custom fonts to be set as Base64 strings (details here)
+☑ Set images as inline Base64 strings
+☑ Basic RSS feed
+☑ Automatically add new pages to footer nav
+☑ Compress inline CSS

+
+

A Single File Blog

+

PHPetite (/p/h/pəˈtēt/) is a single file, static blog generated from PHP. Based off the very minimal and awesome portable-php

+

Key Features

+
    +
  • Entire blog is rendered in a single HTML file
  • +
  • Inline, compressed CSS
  • +
  • All images converted into base64 encoding
  • +
  • Minimal requirements / no heavy build tools
  • +
+
+

Feel free to look through the documentation found posted on this site or directly in the github repo.

+

Getting Started

+

+ +
+
+ + + -- cgit v1.2.3-54-g00ecf