librelist archives

« back to archive

Re: Current page or article full URL

Re: Current page or article full URL

From:
Jason Clark
Date:
2012-11-14 @ 19:09
I don't think this made it to the list. I'm hoping someone know the answers?

Thanks,
Jason

On Nov 14, 2012, at 11:06 AM, Jason Clark <jason@jjasonclark.com> wrote:

> I'm setting up a Twitter button for my blog and I need to create a URL 
of the current article. I was thinking `url(@page.permalink)` would do it,
but its not exactly what I want. I also want this link to have the host 
name while in the development mode. Is there a way I can get this? What 
about if I set a value in the config file. Could I include this somehow in
the #url call?
> 
> Thanks,
> Jason
> 
> 

Re: [nesta] Current page or article full URL

From:
Graham Ashton
Date:
2012-11-15 @ 15:39
On 14 Nov 2012, at 19:09, Jason Clark <jason@jjasonclark.com> wrote:

> I'm setting up a Twitter button for my blog and I need to create a URL 
of the current article. I was thinking `url(@page.permalink)` would do it,
but its not exactly what I want.

Have a look at Sinatra's `uri` method (which they've helpfully [not]) 
aliased as `to` and `url`, in case it was too clear... ;-)

https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L180

Check the second argument; I reckon setting that to true might do it.

If not, I think there'll be enough code inside that method for you to be 
able to work something out.

Cheers,
Graham

-- 
Graham Ashton
Founder, The Agile Planner
http://theagileplanner.com | @agileplanner | @grahamashton