Files
website/content/blog/now.html
2025-12-21 20:44:36 -08:00

58 lines
3.1 KiB
HTML

<article>
<header id="title-block-header">
<p class="date">2025-12-21 18:00:00 -08:00</p>
<h1 class="title">A Now Page</h1>
</header>
<p>I have decided to create <a href="/now/">a Now page</a> for my website. Here is <a href="https://indieweb.org/now">the official documentation</a> for Now pages, but I decided to put my own spin on the idea. I have been considering adding a microblog page for my website, which would be a place that I can quickly add posts, something like <a href="https://github.com/buckket/twtxt">a twtxt file</a>, but I don&#39;t particularly like a permanent, endlessly long file for a microblog. I prefer treating microblog posts as temporary and ephemeral, that&apos;s the reason why I have my Mastodon posts delete themselves after a year.</p>
<p>I have created the following script for quickly and easily updating to my Now page and Mastodon at the same time from my terminal. This script compliments the blog.sh script I have created for building this website, which you can look at in <a href="https://git.0x212.com/iiogama/website">the git repo</a>.</p>
<p>All I need to do is run something like this:</p>
<pre>post.sh &quot;Extremely thoughtful message for my thousands of followers&quot;</pre>
<p>and my scripts will post my thoughts to Mastodon, update my Now page, update <a href="/index.xml">my RSS feed</a>, and upload the files to my web server.</p>
<h2>Post.sh script</h2>
<pre>
#!/usr/bin/env bash
TIMESTAMP=&quot;$(date &apos;+%Y-%m-%d %H:%M:%S %:z&apos;)&quot;
ID=&quot;$(date -d &quot;$TIMESTAMP&quot; &apos;+%Y%m%d%H%M%S&apos;)&quot;
POST=&quot;$*&quot;
CHARCOUNT=&quot;$(printf &apos;%s&apos; &quot;$POST&quot; | wc -c)&quot;
CHARLIMIT=&quot;500&quot;
if [[ &quot;$CHARCOUNT&quot; -gt &quot;$CHARLIMIT&quot; ]]; then
if [[ &quot;$(command -v vipe)&quot; = &quot;&quot; ]]; then
printf &apos;Error: Unable to create post. Character count is %s/%s&apos; &quot;$CHARCOUNT&quot; &quot;$CHARLIMIT&quot;
printf &apos;Tip: Install moreutils for vipe command.&apos;
exit 1
else
printf %s &quot;$POST&quot; | vipe
fi
fi
masto() {
if [[ &quot;$(command -v toot)&quot; = &quot;&quot; ]]; then
printf &quot;Error: Unable to post to Mastodon, toot command not found.\n&quot;
else
toot post &quot;$POST&quot;
fi
}
now() {
local THIS_BLOG_DIR
THIS_BLOG_DIR=&quot;$HOME/Documents/blog&quot;
source &quot;$THIS_BLOG_DIR/config.env&quot;
local THIS_NOW_DIR
THIS_NOW_DIR=&quot;$THIS_BLOG_DIR/$NOW_DIR&quot;
local THIS_TEMPLATES_DIR
THIS_TEMPLATES_DIR=&quot;$THIS_BLOG_DIR/$TEMPLATES_DIR&quot;
test -d &quot;$THIS_NOW_DIR&quot; || mkdir -p &quot;$THIS_NOW_DIR&quot;
local HTML_DATE
HTML_DATE=&quot;&lt;p&gt;&lt;i class=\&quot;date\&quot;&gt;$TIMESTAMP&lt;/i&gt;&lt;/p&gt;&quot;
local HTML_POST
HTML_POST=&quot;&lt;p&gt;$(echo &quot;$POST&quot; | sed &apos;s!\n!&lt;/p&gt;&lt;p&gt;!g&apos;)&lt;/p&gt;&quot;
printf &apos;&lt;article&gt;\n%s\n%s\n&lt;/article&gt;&apos; &quot;$HTML_DATE&quot; &quot;$HTML_POST&quot; &gt; &quot;$THIS_NOW_DIR/index.html&quot;
cp &quot;$THIS_NOW_DIR/index.html&quot; &quot;$THIS_NOW_DIR/$ID.html&quot;
cd &quot;$THIS_BLOG_DIR&quot;
just _push_blog
}
masto
now
</pre>
</article>