The discussion revolves around creating permalinks for every topic during import. pfaffman is updating bbpress.rb to deal with attachments and create permalinks for old URLs. He questions whether there’s any reason not to create a permalink for every topic.
vinothkannans points out that there’s already an option for this and shares a link to a relevant meta discussion. pfaffman is automating the process in the importer, rather than having users manually create permalinks in the Rails console.
Falco suggests that doing redirects in Nginx would be faster than in Discourse, but acknowledges that Discourse is easier and more portable. pfaffman decides to add a redirect for every topic, but Falco suggests having an easy way to turn this off, especially for custom imports. pfaffman adds this option.
sam agrees with creating permalinks for every topic, stating that it does an indexed lookup, which is very cheap. The changes are implemented in a pull request (pfaffman).
I’m updating bbpress.rb to have it deal with attachments (now it inserts a link to the attachment on the original site) and create permalinks for the old URLs.
The old format is `/forums/topic/slug’. For anyone who knows how to write an Nginx redirect, it’s pretty simple to redirect that to /t/slug and be done with it. OTOH at this particular instant, it is faster for me to add code to the importer to create those permalinks.
Question: Is there any reason not to create a permalink for every topic?
No, that’s what I’m doing, though rather than having to enter the rails console and find a way to do a Permalink.create for every URL, I’m doing that automatically in the importer. Normal People should not be subjected to the Rails console.
My current hypothesis is that it might actually be (a very tiny bit) better to have Discourse do the redirects than to get Nginx to do it, as adding that redirect will cause Nginx to have to process it on every url request.
Actually, doing it on Nginx should be way faster than doing in Discourse. The problem is that Discourse is way easier, friendly and portable, while Nginx should be treated in a case-by-case basis.
Thanks, @falco. I’ll take that as a “no.” There’s no reason not to have the importer add a redirect for every topic, and no reason to make it easy to turn off that functionality (e.g., by setting an environment variable).