Open ghost opened 6 years ago
So the idea behind the slug was that you use the part of your blog post urls that is different for every post.
let's say your blog urls look like this:
https://mysite.com/blog/2018-11/this-is-a-post.html https://mysite.com/blog/2018-10/another-post-right-here.html https://mysite.com/blog/2017-04/a-really-old-post.html
then the url schema can be described as:
https://mysite.com/blog/
+ slug + .html
and the slugs would be 2018-11/this-is-a-post
, 2018-10/another-post-right-here
and 2017-04/a-really-old-post
.
in this scenario you'd set the page_url
schnack config to be
{
"page_url": "https://mysite.com/blog/%SLUG%.html"
}
and it should all work with slack.
closing this for now
There is more to this. The "/" in the slug causes a problem. See:
https://schnick.schnack.cool/comments/post-slug -> returns 200
https://schnick.schnack.cool/comments/post/slug -> returns 404
To solve this I had to escape the "/" in the form of "post%2Fslug" and configure my webserver to allow escaped slashes so that:
https://schnick.schnack.cool/comments/post%2Fslug returns 200
slack.js:
const post_url = config.get('page_url').replace('%SLUG%', event.slug)+'#comment-'+event.id;
page_url:
"page_url": "https://example.com/%SLUG%",
In blogpost:
This all works. But I need output following:
title/slug
and NOTtitle+++++slug
If I do
.join('/')
then schnack does not work at all, it fully crashes. I need the slash/
as separator betweentitle
andslug
.How to fix?