Search code examples
javascriptnode.jsejsghost-bloghexo

Permalink in const_url


In my config file I basically have permalink: :inLink/:title/ which makes the following possible:

https://example.com/hello/post-1 (= all good!)

So, inLink = hello in my markdown file.

Now I have this line also … const post_url = config.get('page_url').replace('%SLUG%', event.slug)+'#comment-'+event.id;

And this renders: https://example.com/post-1(= bad!)

So the inLink permalink variable hello is missing from this.

Question is now how/where to add the inLink variable here in this line… const post_url = config.get('page_url').replace('%SLUG%', event.slug)+'#comment-'+event.id; ???


Solution

  • In the Ghost docs it specifies page_url as

    Helper - Output the URL for a given page in a list (i.e. next page) This helper is used in the pagination template required by the {{pagination}} helper to output the URL for the next, previous or a specific page. It expects a variable which contains the page number you want to output.

    The helper can also interpret the strings "next" and "prev", to display a next/previous link outside of the context of pagination.

    I think you want url, possibly the absolute URL

    Something like: "{{url absolute="true"}}"