9

Since Data Explorer allows us to create links to any of the "unlinked pages" (like suggested-edits, timeline, revisions etc) it would be useful to have a convenient way to get the URL of the site currently selected in the SEDE.
I have recently created a query which does exactly that: Get current site URL. But its reusage in every query which requires that URL (like this one or those) looks like overkill to me. Instead I propose to add se_site_url() function or ##SiteURL## variable (which will be populated with the selected site URL).

2
  • Seems straightforward enough to me...I'll look at getting an implementation together later today.
    – Tim Stone
    Mar 28, 2012 at 8:06
  • Thanks for the fast reaction, @Tim ;)
    – Volo
    Mar 28, 2012 at 8:53

1 Answer 1

10

Well, since we already support arbitrary autolinking if your results have something like

http://example.com/|link text

I thought the easiest way to solve this problem was to introduce a site:// protocol so you could return a column

'site://posts/' + CAST(Id AS nvarchar) + '/revisions|History for Post ' + 
CAST(Id AS nvarchar) AS [Revisions]

for instance, to produce links in the rendered form of the following Markdown:

[History for Post <id>](http://x.stackexchange.com/posts/<id>/revisions)
                        ^------------------------^ based on queried site

I've pushed out the change to my project, but I'll need to chat with waffles to make sure he's alright with that approach before I can promise it'll end up in the actual Data Explorer. You can see the above example in action in this query.

Hopefully this approach works for your needs too - if you really need the site URL in variable form I don't see why that couldn't be done, but I thought this syntax was a little easier if the primary concern was link construction.

7
  • +1 for the site:// protocol, it looks like an elegant solution to me. (I even think this approach could be extended beyond the SEDE, e.g. to support post:// protocol in the asnwers or comments, but that's another story for another FR).
    – Volo
    Mar 29, 2012 at 10:23
  • 1
    data.stackexchange.com/faq is lagging behind. Is there a more complete documentation somewhere, that includes newer features such as this one, and is better organized than MSO posts? Jun 14, 2012 at 9:18
  • @Gilles Not entirely, no. I'm interested in improving the documentation on Data Explorer itself to bring it completely up to date, but I haven't had the time to do so just yet. If anyone's interested in helping with that, please let me know.
    – Tim Stone
    Jun 14, 2012 at 10:34
  • @TimStone I might (not now, but in July). What already exists? How much familiarity with the language and framework do you think would be required? (I don't know C# or databases.) Jun 14, 2012 at 10:43
  • @Gilles Cool. It's pretty much just what's on the site itself plus whatever's here on Meta (my "not entirely" was probably terrible word choice, in retrospect), and then whatever's left over that I'll have to provide additional detail on. Once we have something, I can take care of adding it to the actual site, but there's some initial effort in figuring out what's missing and compiling information from me/anyone else who's familiar with how it works into something user/documentation-friendly (which would be largely non-technical).
    – Tim Stone
    Jun 14, 2012 at 10:59
  • @Gilles Okay, this ended up taking a bit longer than expected, but new documentation is pending a pull and deploy. Once it goes live, feel free to let me know if it looks like anything is missing.
    – Tim Stone
    Jul 19, 2013 at 0:32
  • @TimStone Neat, thanks. Oh, I never got around to looking at this stuff last year. Sorry if I gave you false hopes. Not going to happen much this July I'm afraid. But I will have a look at what you wrote when it's up. Jul 19, 2013 at 10:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .