4

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; ???

  • what does config.get('page_url') return for you ? – SirPeople Jun 26 '18 at 07:24
  • @SirPeople - the page URL but the "inLink" variable (in my example "hello") is NOT included somehow. I am also very surprised. –  Jun 26 '18 at 14:14

1 Answers1

3

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"}}"

simsom
  • 2,446
  • 1
  • 13
  • 13