Route share links through app

pull/142/merge
Thibaut 10 years ago
parent 1ec9140e78
commit fa73dba4e6

@ -25,7 +25,5 @@ app.templates.notifNews = (news) ->
app.templates.notifShare = -> app.templates.notifShare = ->
textNotif """ Hi there! """, textNotif """ Hi there! """,
""" Like DevDocs? Help us reach more developers by sharing the link with your friends, on """ Like DevDocs? Help us reach more developers by sharing the link with your friends, on
<a href="https://twitter.com/intent/tweet?url=http%3A%2F%2Fdevdocs.io&via=DevDocs&text=All-in-one%2C%20quickly%20searchable%20API%20docs%3A" target="_blank">Twitter</a>, <a href="/s/tw" target="_blank">Twitter</a>, <a href="/s/fb" target="_blank">Facebook</a>,
<a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdevdocs.io" target="_blank">Facebook</a>, <a href="/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """
<a href="http://www.reddit.com/submit?url=http%3A%2F%2Fdevdocs.io&title=All-in-one%2C%20quickly%20searchable%20API%20docs&resubmit=true" target="_blank">Reddit</a>,
etc.<br>Thanks :)"""

@ -141,6 +141,18 @@ class App < Sinatra::Application
settings.news_feed settings.news_feed
end end
get '/s/tw' do
redirect 'https://twitter.com/intent/tweet?url=http%3A%2F%2Fdevdocs.io&via=DevDocs&text=All-in-one%2C%20quickly%20searchable%20API%20docs%3A'
end
get '/s/fb' do
redirect 'https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdevdocs.io'
end
get '/s/re' do
redirect 'http://www.reddit.com/submit?url=http%3A%2F%2Fdevdocs.io&title=All-in-one%2C%20quickly%20searchable%20API%20docs&resubmit=true'
end
get %r{\A/(\w+)(\-[\w\-]+)?(/)?(.+)?\z} do |doc, type, slash, rest| get %r{\A/(\w+)(\-[\w\-]+)?(/)?(.+)?\z} do |doc, type, slash, rest|
return 404 unless @doc = settings.docs[doc] return 404 unless @doc = settings.docs[doc]

Loading…
Cancel
Save