dg01d / nanopub Goto Github PK
View Code? Open in Web Editor NEWMicroPub support for Static Blog Engine
License: BSD 3-Clause Clear License
MicroPub support for Static Blog Engine
License: BSD 3-Clause Clear License
I installed the packages, but symfony/yaml
wasn’t installed. Deleting composer.lock fixed this issue.
When writing files using the YAML front matter format, the slug
value is returned as an array, i.e.:
slug:
- my-nanopub-micro-note
As slug
is a single value, the expected output is slug: my-nanopub-micro-note
.
Since the change to a simplified front-matter creation system, syndication is now working.
Copying from #11
Trying to get nanopub working on a site running PHP7, and getting errors.
php composer.phar install
worked:
# php composer.phar install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Package operations: 19 installs, 0 updates, 0 removals
- Installing guhelski/forecast-php (1.1.1): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)
- Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
- Installing guzzlehttp/guzzle (6.3.0): Downloading (100%)
- Installing j7mbo/twitter-api-php (1.0.6): Downloading (100%)
- Installing p3k/timezone (0.1.0): Downloading (100%)
- Installing mf2/mf2 (v0.3.2): Downloading (100%)
- Installing indieweb/link-rel-parser (0.1.3): Downloading (100%)
- Installing p3k/http (0.1.5): Downloading (100%)
- Installing zendframework/zendxml (1.0.2): Downloading (100%)
- Installing miniflux/picofeed (v0.1.37): Downloading (100%)
- Installing facebook/graph-sdk (5.6.1): Downloading (100%)
- Installing ezyang/htmlpurifier (v4.9.3): Downloading (100%)
- Installing dg/twitter-php (v3.6): Downloading (100%)
- Installing cebe/markdown (1.1.2): Downloading (100%)
- Installing p3k/xray (v1.4.2): Downloading (100%)
- Installing symfony/yaml (v3.4.4): Downloading (100%)
- Installing tantek/cassis (v0.2.16895): Downloading (100%)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
mf2/mf2 suggests installing barnabywalters/mf-cleaner (To more easily handle the canonical data php-mf2 gives you)
facebook/graph-sdk suggests installing paragonie/random_compat (Provides a better CSPRNG option in PHP 5)
symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command)
Generating autoload files
I ran the update, as suggested:
# php composer.phar update
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 7 updates, 1 removal
- Removing miniflux/picofeed (v0.1.37)
- Updating facebook/graph-sdk (5.6.1 => 5.6.2): Downloading (100%)
- Installing p3k/picofeed (v0.1.38): Downloading (100%)
- Updating mf2/mf2 (v0.3.2 => v0.4.3): Downloading (100%)
- Updating p3k/http (0.1.5 => 0.1.7): Downloading (100%)
- Updating ezyang/htmlpurifier (v4.9.3 => v4.10.0): Downloading (100%) - Updating p3k/xray (v1.4.2 => v1.4.23): Downloading (100%)
- Updating guzzlehttp/guzzle (6.3.0 => 6.3.2): Downloading (100%)
- Updating symfony/yaml (v3.4.4 => v3.4.8): Downloading (100%)
Writing lock file
Generating autoload files
Here are the errors:
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Notice: Undefined index: like_site in /var/www/html/known/micropub/nanopub.php on line 559"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Notice: Undefined index: repost_site in /var/www/html/known/micropub/nanopub.php on line 573"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Notice: Undefined index: replysite in /var/www/html/known/micropub/nanopub.php on line 587"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Fatal error: Uncaught Error: Call to undefined function Symfony\Component\Yaml\ctype_digit() in /var/www/html/known/micropub/vendor/symfony/yaml/Inline.php:209"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "Stack trace:"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#0 /var/www/html/known/micropub/vendor/symfony/yaml/Dumper.php(123): Symfony\Component\Yaml\Inline::dump('slug', 0)"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#1 /var/www/html/known/micropub/vendor/symfony/yaml/Yaml.php(149): Symfony\Component\Yaml\Dumper->dump(Array, 2, 0, 0)"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#2 /var/www/html/known/micropub/nanopub.php(243): Symfony\Component\Yaml\Yaml::dump(Array)"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#3 /var/www/html/known/micropub/nanopub.php(754): write_file(Array, 'test test test', '../content/micr...')"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#4 {main}"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: " thrown in /var/www/html/known/micropub/vendor/symfony/yaml/Inline.php on line 209"
172.17.0.1 - 10/Apr/2018:00:58:13 +0000 "POST /micropub/nanopub.php" 500
Hello,
Thank-you so much for addressing #3. I’m stumbling across a few things as I try to install this on my own server, so thought I would file issues as I come across them. Hope you don’t mind?
Okay, so the first issue is that setting up Compass is non-trivial, and I’m not sure necessary for basic functionality (although I am curious, so might set this up in the future). Ideally, this would be an optional feature, that would only be activated should the required configuration/keys be available.
For the moment, I have just commented out the following lines, which seems to do the trick:
// $weather = getWeather();
// $frontmatter = array_merge($frontmatter, $weather);
Hello! This looks like a fantastic project – although sadly just one of only a few options available for anyone wanting to implement MicroPub and publish to a statically-generated site.
How difficult/possible would it be to add support for documents that use YAML for their front matter data, rather than JSON? I know Hugo documents can use YAML as well as JSON (and TOML), but perhaps more to the point, Jekyll documents only use YAML. Adding this format would increase the number of static generators Nanopub is able to support. (Looking at the code, I suspect being able to configure where documents are saved would be needed to fully support Jekyll, but I can add that as a separate issue, if that’s the case.)
Any plans to support YAML? If not, pointers as to where and what to edit would be most helpful.
Thanks,
Paul
This feature request is probably quite a complex and far reaching, but adding for consideration. This feature can be seen in other similar Micropub libraries (webpage-micropub-to-github, micropub-github-pages), where the resulting document is saved to a GitHub repo, rather than directly to a server.
This is particularly useful for those cases where a site is hosted with GitHub Pages, if a publisher wishes to version their files, or generate them as part of a continuous integration workflow.
As noted on the documentation page for getallheaders
:
Beware that RFC2616 (HTTP/1.1) defines header fields as case-insensitive entities. Therefore, array keys of getallheaders() should be converted first to lower- or uppercase and processed such.
nanopub currently requires a case-sensitive Authorization
. This means it does not work with Omnibear which in my testing sends a lowercased authorization
header instead.
nanopub should be accepting all possible cases of the received header.
Not sure if I’ve not got something set up correctly – or perhaps because I’m not using Hugo (I’m testing using a bare site that only includes the code for nanopub) – but when posting via Quill, the resulting file is always called Array.md
.
The installation documentation
https://github.com/dg01d/nanopub/blob/master/INSTALLATION.md
mentions settings for
since commit:
The storage locations however are still hardcoded in the source.
Hello,
I came across this post by you.
So, after nanopub does its thing.. you do have to rerun hugo. So that makes sense.
But then, the questions are:
content/
dir to save that new content to.. because the script is running on my domain.. which has no access to the actually site source in Markdown.curl -X POST -d '' https://api.netlify.com/build_hooks/MY_API"
.
So many questions!
All of this can theoretically work if nanopub is able to create new content on Netlify disk.. which I don't know how to test.
Trying to get nanopub working on a site running PHP7, and getting errors.
php composer.phar install
worked:
# php composer.phar install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Package operations: 19 installs, 0 updates, 0 removals
- Installing guhelski/forecast-php (1.1.1): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)
- Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
- Installing guzzlehttp/guzzle (6.3.0): Downloading (100%)
- Installing j7mbo/twitter-api-php (1.0.6): Downloading (100%)
- Installing p3k/timezone (0.1.0): Downloading (100%)
- Installing mf2/mf2 (v0.3.2): Downloading (100%)
- Installing indieweb/link-rel-parser (0.1.3): Downloading (100%)
- Installing p3k/http (0.1.5): Downloading (100%)
- Installing zendframework/zendxml (1.0.2): Downloading (100%)
- Installing miniflux/picofeed (v0.1.37): Downloading (100%)
- Installing facebook/graph-sdk (5.6.1): Downloading (100%)
- Installing ezyang/htmlpurifier (v4.9.3): Downloading (100%)
- Installing dg/twitter-php (v3.6): Downloading (100%)
- Installing cebe/markdown (1.1.2): Downloading (100%)
- Installing p3k/xray (v1.4.2): Downloading (100%)
- Installing symfony/yaml (v3.4.4): Downloading (100%)
- Installing tantek/cassis (v0.2.16895): Downloading (100%)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
mf2/mf2 suggests installing barnabywalters/mf-cleaner (To more easily handle the canonical data php-mf2 gives you)
facebook/graph-sdk suggests installing paragonie/random_compat (Provides a better CSPRNG option in PHP 5)
symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command)
Generating autoload files
I ran the update, as suggested:
# php composer.phar update
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 7 updates, 1 removal
- Removing miniflux/picofeed (v0.1.37)
- Updating facebook/graph-sdk (5.6.1 => 5.6.2): Downloading (100%)
- Installing p3k/picofeed (v0.1.38): Downloading (100%)
- Updating mf2/mf2 (v0.3.2 => v0.4.3): Downloading (100%)
- Updating p3k/http (0.1.5 => 0.1.7): Downloading (100%)
- Updating ezyang/htmlpurifier (v4.9.3 => v4.10.0): Downloading (100%) - Updating p3k/xray (v1.4.2 => v1.4.23): Downloading (100%)
- Updating guzzlehttp/guzzle (6.3.0 => 6.3.2): Downloading (100%)
- Updating symfony/yaml (v3.4.4 => v3.4.8): Downloading (100%)
Writing lock file
Generating autoload files
Here are the errors:
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Notice: Undefined index: like_site in /var/www/html/known/micropub/nanopub.php on line 559"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Notice: Undefined index: repost_site in /var/www/html/known/micropub/nanopub.php on line 573"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Notice: Undefined index: replysite in /var/www/html/known/micropub/nanopub.php on line 587"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Fatal error: Uncaught Error: Call to undefined function Symfony\Component\Yaml\ctype_digit() in /var/www/html/known/micropub/vendor/symfony/yaml/Inline.php:209"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "Stack trace:"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#0 /var/www/html/known/micropub/vendor/symfony/yaml/Dumper.php(123): Symfony\Component\Yaml\Inline::dump('slug', 0)"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#1 /var/www/html/known/micropub/vendor/symfony/yaml/Yaml.php(149): Symfony\Component\Yaml\Dumper->dump(Array, 2, 0, 0)"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#2 /var/www/html/known/micropub/nanopub.php(243): Symfony\Component\Yaml\Yaml::dump(Array)"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#3 /var/www/html/known/micropub/nanopub.php(754): write_file(Array, 'test test test', '../content/micr...')"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: "#4 {main}"
[10-Apr-2018 00:58:14] WARNING: [pool www] child 13 said into stderr: " thrown in /var/www/html/known/micropub/vendor/symfony/yaml/Inline.php on line 209"
172.17.0.1 - 10/Apr/2018:00:58:13 +0000 "POST /micropub/nanopub.php" 500
I have a need for my micropub endpoint to occasionally do something more than just create a YAML file. I might want to add elements to a JSON data structure for use with Hugo data-driven templates, for example. It would be swell if Nanopub could support invoking additional scripts by way of a plugin mechanism.
Hello,
The config.php needs twitter api and stuff, which I believe shouldn't be publicly committed? or not committed to git at all, even if private?
Can those be set using env vars?
(On Netlify, I can set env vars like TWITTER_API_SECRET, and php can then read the value from the env var?)
[my config.php so far -- I am just committing things to my static dir for now, and then see how it goes.. I still have a big questionmark if this will even work for me on Netlify where I don't own/manage the hosting space.]
Hello,
In the Installation instructions, it says:
Since the 1.2 release, nanopub requires the use of Composer. Getting it to do all the things I wanted it to do was getting way beyond my skill level.
I have 0 experience with PHP, and don't plan to tinker with the code.
So I assume that installing Composer is not a requirement?
Can you please list the installation steps just to get the endpoint running for someone with no PHP experience like myself?
As noted in the code, currently files are saved to hard coded locations. Allowing these to be customised (I guess on a post-type basis) would enable this to work with different folder set ups.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.