Intra-post permalink


(Jason Sachs) #1

Is there any way to have an intra-post permalink with only a URL hash?

In other words, if I want to link to reply #3, can I do that? The regular permalink is a full URL, and if I add that, then it requires a page reload. Since it’s the same page, is there any way to link to a reply with only a URL hash?


test: [quote=“elijah, post:4, topic:56880”]well the [quote] syntax works, but it creates an inline quote, I just want a link.[/quote]


(Jason Sachs) #2

test reply 1…


(Jason Sachs) #3

test reply 2…


(Eli the Bearded) #4

Are you asking for something like the link you get with

[quote="USER, post:N, topic:M, full:true"]

?

You could possibly add just stub quotes.


(Jason Sachs) #5

[quote=“elijah, post:4, topic:56880”]

Sort of, but I just want to make it into a link that ends up as a URL fragment (intra-page link). See my “example of full URL link” in the original post.


(Eli the Bearded) #6

Off-hand I don’t think that is doable, but it makes it clear what you want.


(Jeff Atwood) #7

Incorrect, it only requires a page reload if the target post is not currently loaded. @eviltrout can confirm.


(Jason Sachs) #8

odd, we have a Discourse server at our company and if I use full URL links, it does cause a page reload. If a page with URL A links to a page with URL B, how can it avoid a page reload? It seems to work correctly on this page (I still don’t understand how), but maybe that’s just a really fast operation that appears seamless to me.


(Vinoth Kannan) #9

The JavaScript doing that magic :slight_smile:

It may behaved like that because of some other reason. Can you please try again?


(Jason Sachs) #10

Please no citations of “magic”; if you know how it works, please let me know. I’m inspecting the link and I see no onclick handler, if something is going on, it is very subtle and I don’t understand.

I guess it must be some evil Ember magic Ember.js - Routing: Preventing and Retrying Transitions


(Jason Sachs) #11

I did try again, it is still doing a page reload, which again, is the behavior I would expect. Both our company’s Discourse instance and this Discourse instance appear to be using 1.8.0.beta4, although different git hashes:

this page: <meta name="generator" content="Discourse 1.8.0.beta4 - https://github.com/discourse/discourse version ba115480ba782587f07cb9d08ac7a77927910a71">

our server: <meta name="generator" content="Discourse 1.8.0.beta4 - https://github.com/discourse/discourse version c36dda70aeb6e97efaf7ad0cb932df18f0281722">


(Régis Hanol) #12

Have you tried adding a space before the link?

Intra-post permalink


(Jason Sachs) #13

Adding a space where?


(Régis Hanol) #14

When it’s on it’s own line, adding a space before the link will prevent it from being oneboxed.


https://meta.discourse.org/t/intra-post-permalink/56880/3

renders as

whereas

 https://meta.discourse.org/t/intra-post-permalink/56880/3

renders as

Intra-post permalink


(Jason Sachs) #15

oh, I see, that explains what “oneboxed” means and why it occurs. Yes, if I put a link all by itself it does that, but if I do something like

[link](http://myserver/t/test-test-test-test-is-a-test-test-argh/343/3)

then it displays properly, but the “magic” page reload interception logic doesn’t work, I get a normal page reload to the URL http://myserver/t/test-test-test-test-is-a-test-test-argh/343/3

The only difference I can see is that our server is http:// (inside company firewall + noncritical server, so it’s much less of a concern) rather than https:// – could this be the difference?


(Blake Erickson) #16

yes, switching between http and https could be causing the page reloads.


(Régis Hanol) #17

The scheme should have no impact unless you have your instance misconfigured (ie. have it think it should use https but there still are links using http).


(Jason Sachs) #18

no, I’m not switching between http:// and https:// – our server is http:// and the links are http://


(Jason Sachs) #19

Is there a way I can troubleshoot this? I have admin privileges, I just have no clue what to look for.


(Vinoth Kannan) #20

I can’t understand why it is happening like that. Can you please share a screencast? You may hide your sensitive details.