Giter Site home page Giter Site logo

plerd's Introduction

Build Status

Plerd

Plerd is meant to be an ultralight blogging platform for Markdown fans that plays well with (but does not require) Dropbox.

It allows you to compose and maintain blog posts as easily as adding and modifying Markdown files in a single folder. Plerd creates an entirely static website based on the content of this one folder, automatically updating the site whenever this content changes.

Optional and experimental Plerd features add support for IndieWeb technologies, such as sending webmentions.

Purpose

Plerd allows a blogger to publish new posts to their blog simply by adding Markdown files to a designated blog-source directory. By mixing in Dropbox, this directory can live on their local machine. They can also update posts by updating said files, and unpublish posts by deleting or moving files from that same folder.

The generated website comprises a single directory containing only static files. These include one "permalink" HTML page for every post, a recent-posts front page, a single archive page (in the manner of Daring Fireball), and syndication documents in Atom and JSON Feed formats. All these are constructed from simple, customizable templates.

That's it! That's all Plerd does.

If you have the time and inclination, you may watch a 20-minute presentation about my reasons for creating Plerd.

Project status

Plerd is released and stable. It still has plenty of room for improvement, and I welcome community feedback and patch proposals, but it will continue to do what it does now, in more or less the same fashion, for the foreseeable future.

I reserve the right to add new features to it, but I will do my best not to break existing functionality when doing so. If you'd like to stay informed of Plerd changes, consider joining the plerd-announce mailing list.

Setup

Installation

First, make sure you have the cpanm program on your machine. It is likely available as "cpanminus" in your favorite package manager. (Or install it from source, through the instructions at http://cpanmin.us.)

Then, run this command:

cpanm Plerd

If you run into issues due to failing dependencies, you can try one of these instead:

cpanm --notest Plerd
# or
cpanm --force Plerd

Alternately, you can run these commands under `sudo` to install Plerd at the system level.

If everything installed as it should, then you should have the plerdall and plerdwatcher programs in your command path.

To install Plerd from source, set the current working directory to the same directory containing this README file, make sure you have cpanm as described above, and then do this:

cpanm --installdeps .
perl Makefile.PL
make
make install

Configuration

  1. Run plerdall --init to create a new directory called plerd/ in your current working directory, populated with all the special files and directories that Plerd requires. This includes a sample config file in plerd/plerd.conf.

    If you'd like the directory named something else or located somewhere else, you can provide it as an argument, e.g. plerdall --init=/some/other/location. See the plerdall man page for full details.

    Here's the purpose of the subdirectories that plerdall --init creates:

    • source: This will hold your blog's Markdown-based source files.
    • templates: Holds your blog's templates. plerdall --init will place a full complement of sample templates in this directory for you.
    • docroot: Will hold your blog's actual docroot, ready for serving up by the webserver software of your choice.
    • conf: Holds your blog's configuration files. plerdall --init will place an example plerd.conf file in this directory for you.
    • db: Will contain metadata about your blog's posts.
    • run: Holds PID files and such.
    • log: The plerdwatcher program will write logs here.

    You can freely add other files or directories in this directory if you wish (a drafts folder, perhaps?). Plerd will happily ignore them.

  2. Edit the plerd.conf file in the directory that you created in the previous step to best suit your needs. The file itself is extensively commented and self-documenting.

    You can optionally move or copy the file to .plerd in your home directory. If you do, that new copy of the file becomes the default configuration file that Plerd's command-line programs will refer to.

  3. As noted above, the templates directory that you created in the first step of this process contains sample templates that you can customize as much as you'd like. They are rendered using Template Toolkit. You can't change these template files' names, but you can add new sub-template files that the main temlates will invoke via the [% INCLUDE %] directive, and so on.

  4. Configure the webserver of your choice such that it treats the docroot subdirectory (which you created as part of the first step) as your new blog's own docroot.

    When running in its basic mode, Plerd does not provide a webserver; it simply generates static HTML & XML files, ready for some other process to serve up.

Usage

Running Plerd

Plerd includes two command-line programs:

  • plerdall creates a new website in Plerd's docroot directory, based on the contents of its source and templates directories. (It also provides a few other "one-off" utility functions, including the --init feature referred to above.)

    Run this program (with no arguments) to initially populate your blog's docroot, and at any other time you wish to manually regenerate your blog's served files.

  • plerdwatcher runs a daemon that monitors the Dropbox-synced source directory for changes, republishing files as necessary.

    This is where the magic happens. While both plerdwatcher and Dropbox's own daemon process run on your webserver's machine, any changes you make to your blog's source directory will instantly update your blog's published static files as appropriate.

    Launch plerdwatcher through this command:

      plerdwatcher start
    

    It also accepts the verbs stop, restart, and status, as well as all the command-line options listed in the App::Daemon documentation.

Composing posts

To start writing a new blog post, just create a new Markdown file somewhere outside of your blog's source directory. (Recall that any change to the source directory instantly republishes the blog, something you won't want to do with a half-written entry on top.) You can name this file whatever you like, so long as the filename ends in either .markdown or .md.

You must also give your post a title, sometime before you're ready to publish it. You define the title simply by having the first line of your entry say title: [whatever], followed by two newlines, followed in turn by the body of your post.

For example, a valid, ready-to-publish source file could be called today.markdown, and it could contain this, in full:

title: My day today

I had a pretty good day today. 

I hung out at [the coffee shop](http://empireteaandcoffee.com). Then I went home.

Well, that's all for now. Bye bye.

Publishing posts

To publish a post, simply move it to Plerd's source directory. (Take care not to overwrite an older post's source file that may have the same name.)

Plerd will, once it notices the new file, give the file a timestamp recording the date and time of its publication. This timestamp will appear in its own line, after the title line.

Normally, Plerd will set the publication time to the moment that you added the file to the source directory. Plerd recognizes two exceptions to this rule:

  • If you manually give your post a time: timestamp, and it's in W3C date-time format, then Plerd will leave that timestamp alone.
  • If you leave the timestamp out, and include in your post's filename a date of yesterday or earlier (e.g. 1994-06-10-i-like-ace-of-base.md), then Plerd will set the post's timestamp to midnight (in the local time zone) of that date. This allows you to batch-backdate many posts at once -- useful, perhaps, for populating a new blog with existing writing.

(Note that Plerd assumes you use a text editor smart enough to see that the source file has both moved and had additional lines added to it from an external process, and to react to this in a graceful fashion.)

Once it has prepared the source file, Plerd will update the blog. It will create a new HTML file for the new entry, and add a link to it from the archive.html page. It will also appear in the recent-posts sidebar of every other entry, as well as the Atom and JSON Feed documents (unless you decided to manually backdate the entry by specifying your own date attribute within the file).

Updating or deleting posts

To update a blog post, just edit its source Markdown file, right in the source directory. Any changes you make will immediately update your published blog as appropriate

To unpublish a blog post, simply move it out of the synced source directory -- or just delete it.

Using Plerd with Dropbox

Plerd loves Dropbox! (Indeed it had Dropbox affinity in mind from the beginning of its design.)

To have Plerd work with Dropbox, just place its working directory (the one containing the source, docroot, and template subdirectories) somewhere in your synced Dropbox folder, and specify the local path to this folder (from your webserver's point of view) in your Plerd config file.

Now, you can create, update, and delete blog posts just by moving and editing files, no matter what computer you're using, so long as it has access to that Dropbox folder.

In this way you could, for example, compose and edit blog posts via Markdown in your favorite text editor while sitting by the fire with your laptop in the back of your favorite coffee shop, publishing updates to your blog by hitting File β†’ Save in your text editor, and not directly interacting with your webserver (or, indeed, with the Plerd software itself) in any way.

Advanced use

Customizing templates

For a brief guide to the template files and how to customize them for your blog, please see the Plerd wiki on GitHub.

Tags

If you define a list of comma-separated tags under a post attribute named tags, then Plerd will add the post to those linked from a file named tags/[tag].html, relative to the blog's docroot. It will also link to that page form tags/index.html.

For example, this attribute would assign three tags to its post:

tags: Media, Books I like, πŸ“š

The default Plerd templates will display links to tag-pages where appropriate. Tag pages get their shape from the template named tags.tt.

Mind your capitalization with tags! If faced with inconsistent capitalization within a single tag, e.g. one post claims "boston" for a tag and other one claims "Boston", then Plerd will prefer the first tag containing capital letters to one that contains none, and it will retroactively apply to across all relevant posts.

User-defined attributes

You can add any attributes you'd like to your posts, and then refer to them from your templates via a hash named attributes attached to every post object. For example, if a post's metadata looks like this:

title: Example of user-defined attributes
byline: Sam Handwich

Then you can refer to post.attributes.byline to fetch that value from within the post.tt template file, even though "byline" is not an attribute that Plerd otherwise recognizes. (If a template refers to an attribute key that a post's source file does not define, it will simply return a blank value.)

Social-media metatags

By defining some extra attributes in both your blog's configuration file, you can direct Plerd to add Open Graph and Twitter Card-enabling metadata tags to each of your posts. This will allow services like Facebook, Twitter, and Slack to present attractive little summaries of your blogposts when displaying links to them.

These blog configuration options (all optional) are:

  • twitter_id: If present, then Plerd will try to attach Twitter Card metadata to each post, associated with the given Twitter username. (No leading '@', please. Yes, I know. It confuses the YAML parser. Sorry...)

  • image: If present, Plerd will use this URL as the location of a default image to use in the metadata for any post that doesn't define its own image attribute.

    If not present, Plerd will not generate any social-media metadata for any post lacking an image attribute.

  • image_alt: A textual description of the image referenced by the image attribute. (Equivalent in usage to the "alt" attribute in an HTML <img> tag.) Plerd will just leave this blank, if you don't define it yourself.

To see examples of all the above, please see the file conf/plerd_example.conf.

Once you've configured your blog as described above, you can add these attributes to any post:

  • description: A very brief summary of this post.

    If not defined, then Plerd will try to use the first paragraph of your post's text (after stripping out any markup) as the post's description.

  • image: The URL of an image to associate with this post within social-media links. (This could refer to image that also appears in your post by way of an HTML <img> tag, but it doesn't have to.)

    If not defined, then Plerd will instead use the blog's image configuration directive. If that is also undefined, then Plerd will not generate any social-media metadata for this post.

  • image_alt: A textual description of the image referenced by the image attribute. (Equivalent in usage to the "alt" attribute in an HTML <img> tag.) Plerd will just leave this blank, if you don't define it yourself.

MultiMarkdown

Plerd supports MultiMarkdown syntax out of the box! Go ahead and put MultiMarkdown tables and stuff into your posts. it'll just work.

Webmention

Plerd supports Webmention, an open technology that allows websites to send simple "Hey, this page of mine contains a link to that page of yours!" messages to other websites. If the linking page employs Microformats2 metadata, then the target page can choose to display salient information about the mention, such as its author, or a summary of its content. It can adjust the format of this display depending upon the mention's apparent type -- a "like", a repost, a comment-style response, and so on.

Thus, with certain options enabled, Plerd can send webmentions to websites that your blog posts link to. Consult the documentation of the plerdwatcher and plerdall programs for details about Webmention-related options.

A note about encoding

Plerd assumes that all your source and template files are encoded as UTF-8.

Support

To report bugs or file pull requests, visit Plerd's GitHub repository.

To keep up to date on Plerd news, or to discuss the software with other users or developers, please join one of the project's mailing lists.

You may also simply simply email me, Jason McIntosh, directly. I am always interested to hear about other folks making use of Plerd, and I will do whatever I can to help them with it. All such feedback does tend to make the software that much better, after all!

Plerd has a homepage at its creator's website.

See Plerd at work

This software powers Jason McIntosh's blog, Fogknife, for which it was written.

Credits

Plerd is by Jason McIntosh ([email protected]). I would love to hear any thoughts about Plerd you would care to share, and welcome any questions or suggestions about it.

Contributors include:

  • Petter Hassberg
  • Joe Johnston
  • Christian SΓ‘nchez
  • David Turner
  • Rebecca Turner

This repository contains the image "Envelope" designed by Jon Testa, and the image "RSS" designed by useiconic.com. Both are shared through a Creative Commons Attribution 3.0 United States license, and come to this project via The Noun Project.

plerd's People

Contributors

chsanch avatar doddo avatar iarna avatar jmacdotorg avatar kyzn avatar manwar avatar novalis avatar taskboy3000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plerd's Issues

Add a webmention moderation tool

Plerd offers no way to moderate webmentions. It should offer a simple web application that allows a blog's owner to approve or delete webmentions.

We may want to consider all webmentions as subject to moderation, holding them in a moderation queue until the owner approves of (or disposes) them. In this case, the owner should be able to set up auto-approval/disposal rules based on source URL. (e.g. all mentions from nytimes.com are auto-approved; all mentions from twitter.com/* are auto-approved, but those from twitter.com/pepe_frog_maga_88 are auto-declined.)

Emoji-only post titles can introduce filename collisions

If you make post titled "πŸ˜€" on a given day, and then make a separate post titled "🎩🎩" on that same day, they will result in identically named HTML files, such that one will overwrite the other.

The logic that decides posts' filenames needs to take account for this situation.

Failed to Compile

cat .cpanm/work/1565588453.21267/build.log

cpanm (App::cpanminus) 1.7044 on perl 5.024001 built for x86_64-linux-gnu-thread-multi
Work directory is /root/.cpanm/work/1565588453.21267
You have make /usr/bin/make
You have LWP 6.15
You have /bin/tar: tar (GNU tar) 1.29
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching Plerd () on cpanmetadb ...
--> Working on Plerd
Fetching http://www.cpan.org/authors/id/J/JM/JMAC/Plerd-1.811.tar.gz
-> OK
Unpacking Plerd-1.811.tar.gz
Entering Plerd-1.811
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.64 ... Yes (7.10_02)
Configuring Plerd-1.811
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Plerd
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Data::GUID 0 ... Yes (0.049)
Checking if you have App::Daemon 0 ... Yes (0.22)
Checking if you have YAML 0 ... Yes (1.29)
Checking if you have FindBin 0 ... Yes (1.51)
Checking if you have Moose 0 ... Yes (2.2011)
Checking if you have Path::Class 0 ... Yes (0.37)
Checking if you have File::HomeDir 0 ... Yes (1.004)
Checking if you have URI 0 ... Yes (1.71)
Checking if you have HTML::SocialMeta 0.72 ... Yes (0.74003)
Checking if you have DateTime::Format::W3CDTF 0 ... Yes (0.07)
Checking if you have Text::MultiMarkdown 0 ... Yes (1.000035)
Checking if you have Readonly 0 ... Yes (2.05)
Checking if you have File::ChangeNotify 0 ... Yes (0.31)
Checking if you have Template 0 ... Yes (2.29)
Checking if you have Mojolicious::Lite 0 ... Yes (undef)
Checking if you have DateTime 0 ... Yes (1.51)
Checking if you have Web::Mention 0.6 ... Yes (0.703)
Checking if you have HTML::Strip 0 ... Yes (2.10)
Checking if you have List::Util 1.45 ... Yes (1.51)
Checking if you have Capture::Tiny 0 ... Yes (0.48)
Checking if you have Try::Tiny 0 ... Yes (0.30)
Building and testing Plerd-1.811
cp lib/Plerd/SmartyPants.pm blib/lib/Plerd/SmartyPants.pm
cp lib/Plerd/WebmentionQueue.pm blib/lib/Plerd/WebmentionQueue.pm
cp README.pod blib/lib/README.pod
cp lib/Plerd/Tag.pm blib/lib/Plerd/Tag.pm
cp lib/Plerd.pm blib/lib/Plerd.pm
cp lib/Plerd/Init.pm blib/lib/Plerd/Init.pm
cp lib/Plerd/Post.pm blib/lib/Plerd/Post.pm
cp lib/Plerd/Util.pm blib/lib/Plerd/Util.pm
cp bin/plerdall blib/script/plerdall
"/usr/bin/perl" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/plerdall
cp bin/plerdwatcher blib/script/plerdwatcher
"/usr/bin/perl" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/plerdwatcher
Manifying 2 pod documents
Manifying 8 pod documents
PERL_DL_NONLAZY=1 PERL_USE_UNSAFE_INC=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/.t
t/basic.t ... ok

Giving the Plerd daemon a few seconds to spin up...

Giving the Plerd daemon a a few seconds to process a change...

Failed test 'Success!'

at t/daemon.t line 99.

got: '0'

expected: '7'

Looks like you failed 1 test of 1.

t/daemon.t ..
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
t/init.t .... ok

Test Summary Report

t/daemon.t (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=3, Tests=46, 22 wallclock secs ( 0.04 usr 0.00 sys + 11.09 cusr 0.51 csys = 11.64 CPU)
Result: FAIL
Failed 1/3 test programs. 1/46 subtests failed.
Makefile:919: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 255
-> FAIL Installing Plerd failed. See /root/.cpanm/work/1565588453.21267/build.log for details. Retry with --force to force install it.

Contrast with other similar offerings like Jekyll and Hugo

I just came across this project and it reminds me of Jekyll and Hugo. Nothing wrong with having your own offering of course :) But it would be helpful if the README or website mentioned these other projects and offered a breakdown of how they compare, especially if there are features of Plerd that other products don't have.

"Reading time" should use the pre-defined metadata fields for this, when available

Plerd posts compute their own estimated reading time, and they also can generate metadata tags for use by e.g. Twitter Cards. Some of these metadata display services -- Twitter Cards included -- either do have specific "reading time" fields, or user-definable fields which can be used for this purpose.

Plerd posts should be able to make use of these fields for reading time, when they are available.

Renaming source files is too fraught.

When used with Dropbox, Plerd's behavior of always renaming source files (unless the filename adheres to the YYYY-MM-DD-title.md pattern) results in (from the client machine's perspective) Dropbox deleting the first file, and then creating a brand new file unrelated to the first one. This confuses my text editor (which invariably still has the first file open) and I don't like it.

Fatpack the webmention listener

One of the main selling points of Plerd to me was that it didn't require that I deploy any software to my server. (I was already syncing static files, all I had to do was set a docroot.)

Webmention support, of course, changes that. One way to reduce deployment friction would be to provide a fatbacked listener binary, that is, a single stand alone script that has all of its dependencies bundled into it.

https://metacpan.org/pod/distribution/App-FatPacker/bin/fatpack

I did this many years ago with this, though I'm sure there's a better way now:

https://github.com/iarna/App-Every/blob/master/build_fatpack.sh

If tags.tt is missing, publication breaks messily

Even if a blog doesn't have any tags (that is, $plerd->has_tags returns false), if tags.tt is missing then trying to publish the blog will result in a fatal error.

tags.tt is arguably the one non-critical template. The blog should always publish if it's missing. Maybe it should voice some warns if the blog does use tags.

index.html symlink broken

Hi,
I just started working with Plerd. So far, I think it is a great tool. Thank you for making it.
One thing I have noticed is that the symlink for index.html is incorrect. It is being created as index.html -> docroot/recent.html but, it needs to be index.html -> recent.html. Is there a configuration parameter that would control this more than path? Originally the path was /plerd so the symlink was /plerd/docroot/recent.html.
Thanks.

sub _build_posts does not sort a file list with both .md and .markdown correctly

This may be irrelevant, considering the list is later sorted by desired publication date, but in the posts builder, this line appears:

            sort { $a->basename cmp $b->basename }

In context, $a and $b are Path::Class::File objects and one might expect basename to return the filename without an extension here. However, it does not. The extension is still present.

Using the venerable File::Basename::basename routine allows the caller to provide a list extensions to be stripped out of the returned file name. However, Path::Class::File::basename does not appear to take extensions as arguments to strip off, which is surprising.

Ultimately, the list of posts is sorted by the desired publication date, which Plerd::Post calculates.

Frankly, I would suggest removing the file sort as it appears do work that is ultimately thrown away.

Marking this as an enhancement because it does not really cause problems in the project. This is sort of "it would be nice to fix for pendantry" issue.

Markdown in auto-generated socialmeta text needs to get stripped

If you make a post whose initial text contains Markdown, and you don't specify any description metadata, then the text that ends up pull-quoted on social media often contains that Markdown and looks yucky.

In the case of no description specified, we should supply the first paragraph with the Markdown stripped out. (So, translated to HTML, and then run through an HTML-stripper, I suppose.)

The "time" attribute is not in W3C format

I just tried to install Plerd on Ubuntu 20.04. To ignore the failed tests, I have used the --force option.

I can generate HTML pages from markdown files but when I want rebuild existing posts with the plerdall command, I get the error message " The "time" attribute is not in W3C format. at /usr/local/share/perl/5.30.0/Plerd/Post.pm line 518."

In the HTML pages, the generated time attribute has the format: "2022-01-03T13:36:23Z".

I suspect a regression or an update in a dependency.

Thanks for your help :)

The "description" method fails with posts leading with images

If a post's source file leads with an image (or any other HTML tag) followed by two carriage returns, the Post class's description object method will understand that as the post's first "paragraph". Thus, if such a post defines no overt "description" attribute in its metadata, then the return value of its description method will be the empty string: it'll fetch that "paragraph", snip out all its HTML tags, and be left with nothing. And that's terrible.

Emoji in post titles result in disagreeing mojibake in filenames

I created a post with an emoji character (πŸ”«) in its title. Plerd responded by creating a file with one sort of mojibake in place of that character, and then giving it published_filename metadata with entirely different mojibake, ensuring that internal links to the post would not work.

Allow multiple base_urls for webmentions' sake

If a Plerd-based blog adheres the now-common practice of forwarding http:// requests to https://, then it won't recognize a well-intentioned webmention sent to the http://-based URL. And this more generally holds true for all situations where a blog quietly redirects all requests to other URLs derivable from the requested ones.

One way to fix this would be to support multiple base_urls in the config -- or one base_url but several recognized aliases. Plerd would then (internally) file its post objects under multiple URLs, making it more flexible about what webmentions it accepts.

plerdall --init fails if there is no plerd.conf already present

The configuration section of the README reads:

Run plerdall --init to create a new directory called plerd/ in your current working directory, populated with all the special files and directories that Plerd requires. This includes a sample config file in plerd/plerd.conf.

plerdall documentation also reads:

Run plerdall --init to create a new directory called plerd/ in your current working directory, populated with all the special files and directories that Plerd requires. This includes a sample config file in plerd/plerd.conf.

However, on a brand new deployment of Plerd, (installed with cpanm) when running plerdall --init or plerdall --init="path/to/some-dir" I get:

Can't start bin/plerdall: I can't find a Plerd config file in /home/user/plerd/plerd.conf, /home/user/plerd/conf/plerd.conf, /home/user/.plerd, or in /home/user/plerd/bin/../conf/plerd.conf, and no other location was specified as a command-line argument. at /home/user/plerd/bin/../lib/Plerd/Util.pm line 38.

(Sorry editing this as I'm troubleshooting to not clutter up the thread)

This fails only if there is no plerd.conf in the directory plerdall --init is being run. Even touching an empty plerd.conf in the directory makes it work. πŸ€·β€β™€οΈ

Furthermore, the message that prints after plerd is deployed in a user-defined directory is:

I have created and populated a new Plerd working directory at /home/b/blog. Your next step involves updating the configuration file at /home/b/blog/plerd.conf. For full documentation, links to mailing lists, and other stuff, please visit http://plerd.jmac.org/. Enjoy!

even though plerd.conf is located in and read from conf/plerd.conf

I would submit a pull request to fix this but I am using this project as a way to learn Perl myself!

Module 'App::Daemon' is not installed

hi.

root@AR:/usr/local# git clone https://github.com/jmacdotorg/plerd plerd-site
root@AR:/usr/local# cd plerd-site
root@AR:/usr/local/plerd-site# curl -fsSL https://cpanmin.us | perl - --installdeps .
it shows:
...
Successfully installed Moose-2.2004
! Installing the dependencies failed: Module 'App::Daemon' is not installed
! Bailing out the installation for ..
89 distributions installed
root@AR:/usr/local/plerd-site#

how to fix it?

plerdall --version should be a thing

Sometimes, it is nice to know which version of plerd is running. plerdall and plerdwatcher (if that continues to be a thing) should consider implementing the common flag --version.

Ideally, this version would match Makefile.PL -> $WriteMakefileArgs{VERSION}. That is going to be a non-started to implement, but if lib/Plerd.pm had an our $VERSION='XX.YY' package variable, Makefile.PL can get it with:

Insert before call to WriteMakefile on line 54

(Sorry, but Perl and markdown are fighting.)


use lib ('./lib'); # or use FindBin to construct an absolute path
use Plerd;

$WriteMakefileArgs{VERSION} = $Plerd::VERSION;

This makes the implementation of --version within plerdall trivial:

Add after my $init_path;


my $version_message = 0;

Add to GetOptions() call


'version' => $version_message,

Add before if ( defined $init_path ) {


if ($version_message) {
printf("plerdall is part of Plerd %s\n", $Plerd::VERSION);
exit(0);
}

Discovery link

Am I missing something, or do the default templates lack a rel="webmention" discovery link?

Example templates disregard timezones in date microformats.

templates/post.tt contains this:

    <data class="dt-published" value="[% post.ymd %] [% post.hms %]"></data>

While that's a technically well-formed datetime property for the the containing h-entry microformats, the results are probably wrong (unless the Plerd instance happens to be running on Greenwich Mean Time).

The value attribute should instead contain UTC-specific data, of the format "YYYY-MM-DD HH:MM:SSZ".

We could do this in the template alone by calling DateTime methods, e.g. post.date.set_timezone( 'UTC' ).ymd, but that may be exposing more of the Perlish under-layer to the templates than I'd like.

Webmention server doesn't know about new posts

If run with the --receive-webmention option, plerdwatcher forks off a child webserver process that acts an HTTP server, listening for incoming Webmention requests. The parent process will continue its "traditional" job of watching the source directory for file changes. So far so good.

The problem at hand is that when the parent plerdwatcher sees a change -- a new post, for example -- and updates its internal DB to match, the child process has no way of knowing about it. So, if someone sends that new post a legitimate webmention, the child process receiving it will think: this target matches no post I know about! And then it will reject it.

PLERD_HOME could be an environment variable

Inspired from Perl, Java, et al, plerd could have a notion of a home directory which it can at least find the conf file. That way, the following "just works":

$ plerdall --init (accept defaults)
$ export PLERD_HOME=$HOME/plerd
$ plerdall # any action

This can be implemented like:

if (!defined $config_file && exists $ENV{PLERD_HOME}) {
$config_file = "$ENV{PLERD_HOME}/conf/plerd.conf";
}

Given that maybe only the config file lives there, the better option might be to have the default config file be $HOME/.plerd.conf?

That implementation is slicker:

if (!defined $config_file && -e "$ENV{HOME}/.plerd.conf") {
$config_file = "$ENV{HOME}/.plerd.conf";
}

Something to ponder.

Whatever you decide, after a user runs plerdall, I would suggest that plerdall should just work if all defaults were accepted.

Non-reply webmentions can get mis-categorized as replies

It appears that if a page named as a webmention source contains any u-in-reply-to links, then Plerd will see treat every link on the page as a reply. So if a post as a reply-to link to some other blog, and then a non-reply link to the Plerd-managed blog in question, Plerd will erroneously display the latter as a reply.

(This might be an issue with the underlying Web::Mention Perl module. Which, it turns out, is also under my management...)

Code blocks?

Trying to add a code block using the standard method (3 backticks) results in a wrapped block of code rather than each line on a new line. Also the alternative method 3~s does not work at all...

What am I doing wrong?

Set up perltidy

This repository should be set up with perltidy (or its moral equivalent).

I would expect this to involve the addiction of a .tidyallrc file, and a tidiness-check to the tests.

plerdall --help should be a thing

As I write this, plerdall --help does this:


jjohn@www:~$ plerdall --help
Unknown option: help
Can't start /usr/local/bin/plerdall: I can't find a Plerd config file in /home/jjohn/plerd.conf,
/home/jjohn/conf/plerd.conf, /home/jjohn/.plerd, or in /usr/local/bin/../conf/plerd.conf, and no other location was specified as a command-line argument. at /usr/local/share/perl/5.24.1/Plerd/Util.pm line 39.

I have observed that --help is a widely adopted convention of many apps. plerdall should consider implementing this.

Web-printed dates don't account for time zones

The date of a blog post on the website is always in UTC, such that if I publish an entry on January 1 at 9 PM Eastern time, it shows up dated January 2. I would prefer that it reflect the server's local time zone.

CRLF newlines in source files mess up publication

If a post's source file uses CRLF (a.k.a. "Windows") newlines instead of nice tidy LF ("Unix") ones, then Plerd will be prevented from publishing because it can't read the post's metadata attributes properly.

(I would often see this expressed as The "time" attribute is not in W3C format. in plerdall error message or as a plerdwatcher log entry.)

Plerd should either accept CRLFs, or fail with a more appropriate error message.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.