What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

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).

share|improve this question
    
Seems straightforward enough to me...I'll look at getting an implementation together later today. –  Tim Stone Mar 28 '12 at 8:06
    
Thanks for the fast reaction, @Tim ;) –  Idolon Mar 28 '12 at 8:53

1 Answer 1

up vote 7 down vote accepted

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.

share|improve this answer
    
+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). –  Idolon Mar 29 '12 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? –  Gilles Jun 14 '12 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 '12 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.) –  Gilles Jun 14 '12 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 '12 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 '13 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. –  Gilles Jul 19 '13 at 10:17

You must log in to answer this question.

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