Links aren't showing in the sidebar or topic summaries on subfolder installs


(Nick) #1

For some reason, when I link to another topic in my Discourse installation, the links do not always show up in the sidebar or in the topic summary, as they seem to here on meta.

What is the intended behavior in this respect? Are all the links supposed to show up in the sidebar? Or only if it’s a quote of another post (that particular scenario seems to work in my case)? Here on meta all the links seem to be in the sidebar…


(cpradio) #2

Are you linking to a restricted category? Or an external site? As I think both of those might not, I need to do more testing for the former scenario.


(Nick) #3

No restricted categories for sure. As far as links to external sites, they behave as follows:

  1. They are shown in the topic summary as I understand they should.
  2. They are not shown in the sidebar. Should they?

Most of the internal links in my installation are not shown either in the sidebar or the topic summary. The ones that are shown seem to be the quotes of other posts or when a link to a topic is posted on a line by itself so it fetches a preview. I can’t quite figure out how it is supposed to be.

I don’t know if it has any relevance, but I’m running Discourse in a subfolder.


(cpradio) #4

That is exactly what the gutter/sidebar links should be, and nothing else.


(Nick) #5

Here on meta I see that inline links to other topics are also ocassionally shown on the sidebar, like here:

However, my “inline links” link above isn’t showing either and it puzzles me. How do I link to another topic such that the link would be shown in the sidebar?

The “inline links” link appeared in the sidebar after I edited the post.

So, I’m still confused. Are any and every links to other topics supposed to appear in the sidebar? This is not working consistently in my installation. Where do I look?


(Felix Freiberger) #6

Yes, they are. The same holds for incoming links (follow your link above and look at my post – it now also links back to your post).

Note that these links are detected server-side, and are not shown to you after you submitted the post, only if the post is viewed later. (This may be a bug?)


(Nick) #7

Yeah, that’s cool and that’s what I’m seeing here on meta. Unfortunately, it isn’t quite working in my installation. Some links do show up in the sidebar, while some others do not. Mostly they don’t. I’m wondering what might be causing this and where to look to figure this out.


(Felix Freiberger) #8

Is there anything different with the links that don’t work?

Is your site public and can you link to a non-working example?


(Nick) #9

I can’t quite figure this out. Will appreciate any help.

Here is a non-working example. There is a link to another topic in the first post and in the 8ths. Neither is shown in the sidebar.

It turns out I’m not immediately finding a working example. I’ll add it here if I find it.

Here is a working example. A link to a topic is dropped on a line by itself.


(Felix Freiberger) #10

Okay, that definitely looks like a qualifying link.

Is Sidekiq happy? (You can check at /sidekiq, Enqueued should be (almost) 0.)

Can you try posting an internal link in a separate post, using only “normal” English characters? Maybe the parser that is picking up these links is confused by the character set. Remember to refresh the page before checking whether the link shows up.


(Nick) #11

Sidekiq seems to be fine. No enqueued jobs; there are a couple of failed ones but they all seem to be related to email processing.

I just tried this in my development installation on localhost, and there the links work fine, so it’s not an issue of the character set.

My only guess is that this is somehow related to the fact that I’m running my production discourse from a subfolder. Will try to look into the code to figure this out.

Thanks for your help, Felix.


(Felix Freiberger) #12

Yes, that would be my last guess: That the code that finds internal links does not expect the /subfolder in the URL and classifies this as a “normal” link.

And it looks like that’s the case: This post on SitePoint should have an internal link, but it doesn’t. I’ll move this topic to #bug.


(Felix Freiberger) #13

Good – that does match the pattern: The parser for pure links is broken. Oneboxes register correctly, however. Good find!


(Nick) #14

Another data point: I just fired up the Postgres console, and I’m seeing that for those links that are not processed properly, there are no entries in the topic_links table, while the correctly processed links are all in topic_links.


(cpradio) #15

Slight correct, that seems to be a quote, not necessarily a onebox. I can confirm on Sitepoint that quotes do get the link in gutter treatment, but oneboxes do not

Onebox:(not working)

Quote: (working)


(Felix Freiberger) #16

Oops, they look quite similar :blush:

I should have checked the raw post. Thanks for the correction :slight_smile:


(Jeff Atwood) #17

Can we follow up on this tomorrow @neil?


(Neil Lalonde) #18

Is this specific to subfolder installs?


(cpradio) #19

It seems so, as they still work here on Meta and my sandbox which is not a sub-folder install.


(Nick) #20

This change resolves the problem for me: