But rather than awaken an old thread ( https://www.elkarte.net/community/index.php?topic=2565.0 )
I'm surprised the topic is three years old and it's not been implemented honestly, it's pretty common to have that as an option out of the box with most web applications in this day and age.
I realize it doesn't matter so much for search engines but it matters to people. I work for a company ( not naming it since I'm not here to promote them ) but we deal with this kind of stuff on a professional level, we build websites, we do marketing and we also do print work. Our clients want this, they ask about it and they are leery when told it's unimportant.
There's data to back it too, in what we've looked at, traffic tends to be higher when using SEF urls, not necessarily due to search engines but link sharing and the like. This is because the URL itself can be descriptive in what is behind the link. This matters when sharing links in e-mail, in print, online.. etc.. It's far more important than nice but throw away features like emoticons
Ultimately I think there's a lot more benefit in human readable urls than people might realize.
I do apologize if there's other more updated threads but the one I linked seemed to be the most active and it showed up in my search firsts. I have implemented human readable urls in many of my own pieces of software I've written for clients, but I do always consider it as part of my original design from the start and have been since the late 90s and early 2000s .. it's such a mainstream feature that it always surprises me to not see it.
Aside from that missing feature I think the software is pretty solid, I didn't realize that wasn't there until I adopted the software for my own forum I've been looking to start for several years.
It's my opinion at least that it should be a higher priority, I'd love to start suggesting this software to clients but that being missing would be a no for most of them I know.
Hi oneduality and welcome. :)
The feature is indeed long overdue and didn't get much love over the years because despite a lot of requests, not many have been willing to jump in and code it.
I ported an addon over from SMF (https://github.com/emanuele45/SimpleSEF ) but as you can see, after the initial porting I didn't spend much time working on it (actually I ported it just not to hear people asking for the feature LOL).
A while ago I set up a project for semantic URLs at github:
https://github.com/elkarte/Elkarte/projects/2
it's pretty much empty both because I set it up as a way to see how projects work and because I did it when still working on closing up 1.1. It may be something to consider for 2.0.
I think it will require quite a bit of changes and probably some even "drastic" (think about the fact that now the subject is the subject of the *message*, not of the topic, and that means each and every message in a topic can have a different subject, so in planning this feature we have to decide what to do to have it "done right"), so... it's a bit of work indeed.
I think most of SEF or similar mods requires only apache rewrite so it is not universal enough for those who use nginx to test or help to develop. It'll be useful if the basis work for both, so it can be tested and developed in both webservers.
However, I am not interested in SEF development since from what I understand, it is not needed by modern SEs.
And since the basic can be found, cloned and developed from the above given github, let those who are interested do that.
Even though it's not a need for proper SEO it still brings a very clean look to a forum, that many people want.
I have rewritten the code (Original Code is Matt Zuba) completely for our Forum Version.
This now run clean and very fast and Google find that very good ;)
All links for actions, member, board, topics and other are rewitten as example ..
url/index.php?action=search; ==> url/search/
url/index.php?board=3; ==> url/board-name/
url/index.php?topic=95.3;#msg27 ==> url/board-name/first-topic-subject/60/#msg27 (20 topics on a page)
url/index.php?action=profile;u=27; ==> url/profile/user-name/
... and mutch more ..
Duplicated names are detected automatically .. so if you have a Topic, User, what else with the same name as any other, the second one becomes a additional dupe number (1..n)
so .. if you have a board with the name "Search", the board is called as /search-1/
Our SEF works very stable over years and is also implemeted in our new forum version..
Fel
I absolutely get it, I've not looked through the code base but been a developer for a long long time, but it seems you should be workable.. I'll take a look at it just to get an idea of what's going on, but I won't make any promise I could personally do anything. I'm already wearing 4-5 hats in my day job that I've not been able to work on my passion projects :) I just think this software is one of the cleanest I've looked at, I like the interface on the back-end and it's feature rich.. so I think the one thing missing is this.
It may not be necessary for search engines, it probably never was to be quite honest. But it's good for human friendly urls .. This actually is shown in our analytics for clients we work with and it's been a make or break feature for a lot of them in projects we deploy. A lot of our clients link things in e-mail, social media, even print material .. People are far less likely to visit a url that looks odd ( index.php?whatever ) .. than a url that makes sense and is self descriptive.
This is becoming more and more true, and it's already a standard feature for most web applications as as a result, so I think it's more important than you'd think. Not so much for casual things, but for those serious about it, it matters.
Is this a core code mod? that would be the only issue I'd have. I am very against modifying core code because it makes upgrading extremely difficult. Otherwise, that looks promising :)
No .. this is a custom implementation for our Forum version .. But this can be adapted for similar forums (like ElKarte)
Ohh, I didn't realize you were mentioning your forum software on ElkArte's forums .. usually that's frowned upon :) so I assumed it was a customization to ElkArte
@emanuele known the code .. she is the right person to implement that for elkarte (I think) ;)
Good point.. I would jump on this myself if I were familiar enough with the code base and had the time, but I'm swamped at work and when I get home I don't think about coding, I think about trying to get back to work on music lol ..
Well .. it's my greates hobby to write good, clean, fast code ;)
I agree, when I started out I worked on all sorts of pet projects, my biggest was work on an AI Chat bot that connected to ICQ/AIM and Yahoo .. I got in legal trouble for that one.. but I had MANY projects. My job evolved and now I do programming, consulting, systems administration which has me on call 24/7 and also my music which has suffered.. so it's hard to find time to write in my spare time... or rather, hard to find the motivation. And if you're not motivated, you won't write quality code.
Sure. If your are willing to share yours
@Feline, I think many of those who are interested can easily port it here.
Well .. we are near to release the next Update (version 1.3) because we have optimized many parts, also the SEF engine.
If this availabe, any registered member can download this release and look at our SEF code .. it's only one file and all parts
can by called via hooks ...
Ofcourse all (c) notices must stay in any clone ... it's licensed under MPL 1.1
Fel
It's interesting, though I doubt it will be as simple as that... SEF as an afterthought isn't super simple but it's doable, and unless the architecture is similar it will require heavy modification indeed..
I kind of like how Joomla CMS has done it with their router framework.. but stripping that out and porting it over would be difficult too, and there'd be no help I'm sure. It's part of the core of the software.
Well ... elkarte and our Forum is based on the same source .. SMF :)
Indeed...
It was not meant in the sense I was expecting you to pick it up, sorry for the misunderstanding , it was more stating the facts that leaded to not have it implemented in Elk up until now. :)
Yep, agree, and that's why I proposed it as project to work on. :)
TBH I (as a user) am not very fond on the "friendly" urls, mostly because I'm kind of old school and from time to time I cannot do copy&paste, but I have to type things (on different devices), so for me it's much easier to type 123 rather than a long title, but of course that's just me. :P
That's why one of the things I would like to evaluate is using a routing php-side, maybe symfony or the routing component of another framework.
I've seen this aproach in other forum software, and works fine with Apache or Nginx or other web server
When relevant (like here) I don't see why it should be frowned upon. The advertisement in the signature is more questionable I suppose.
I don't give a darn about it looking "clean", but I definitely prefer elkarte.net/community/sef-blablabla over community/index.php?topic=4848 because then I know what it is I'm clicking on.
I despise the rise of URL shorteners. :)
Heck, you could also have something like elk.com/?t=1234&legible-but-totally-unused=sef-urls-yes-i-know-its-been-discussed
Also, while I'm not fond of the idea, with History.push() you could just pretend on the client-side without any server involvement at all.
A question for
@Feline, does your forum + customized SEF mod work well on Nginx?
FYI she is a he. :D
Okay, sometimes women have beards too.
lol
esp dwarves (yay LOTR)
I love LOTR and all stories that play in Tolkien's worlds! oh, I still have to read the letters to Santa Claus! O:-)
Because I don't have Nginx I can't test it ...
What you need is a mod_rewrite like apache have ..
This is the .htaccess
# sef engine
RewriteBase /forum/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Fel
That part is quite easy in Nginx. But others, I am not so sure. However, thank you very much for the information.
No harder in Lighttpd either. ;)
Well .. the PHP code itself is very complexe ..
But .. the most entrys can be done with hooks.
Fel
Hi Feline, can“t you write the SEF Mod for Elkarte or do you want to keep this just for your own PortaMX forum ?
I don't write code for Elkarte ... only for our Forum version.
Let's use that just because it's the first topic that came up from the search.
Today I started playing with semantic urls.
The current progress is this one:
https://github.com/elkarte/Elkarte/compare/development...emanuele45:semantic_urls?expand=1
The general idea is:
- Url_Generator stores all the possible alternative "url generators",
- "Standard" is the normal one, no whistles, current ?topic=123 etc. and it will be the default fallback in case a "type" of URL is not known (I'm not entirely sure if this feature is actually needed, but it seemed fit into the design, so I added it, or maybe at the time I was thinking to use it differently... who knows.),
- the semantic URLs will be created by another class, and in case something "special" is required, it can be dealt with by adding new types.
The way the code works should be somehow easy I think, I created a function that calls the singleton (yeah, again, I know, I just didn't know where to put the darn stuff, so for the time being I stuffed it in a singleton that looks nicer that $context to me, at least for this kind of things).
The example I used is:
'url' => $scripturl . '?action=markasread;sa=all;bi;' . $context['session_var'] . '=' . $context['session_id']
that becomes:
'url' => getUrl('action', array('action' => 'markasread', 'sa' => 'all', 'bi', $context['session_var'] => $context['session_id']))
I'm pretty sure purist of speed will frown at the fact it needs a function call... feel free to stick with your buffer rewrite. :P
Of course, this is just the easy part, now the two difficult ones:
- parse the GET,
- replace all the URLs in the code base
And since 2 is
massive, I decided to post it here to get some feedback regarding the code, if anyone sees problems or lacks of features, because I would like to avoid having to redo everything two times. O:-)
Quick look I think its good
May want to consider moving the session var and id stuff to the getUrl() function, maybe as a third param done as true/false. True by default with an false option not to add it (I guess that may be needed somewhere maybe?)
Good point.
Maybe, though, false by default, I think the number cases we do not want session is far greater than when we want it?
I'll try to get some number later.
@Spuds https://github.com/elkarte/Elkarte/commit/2cb27b92618654601f2d55cd04f5221d2f8fb579 since we already use "replacements" all over the place, I thought it may work here as well. O:-)
What do you think?
Getting all fancy on me ... I like it !
Any idea why in certain list where the url is sprintf'ed, $scripturl has an strtr to replace single % to %%?
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
I kind of found my answer. It was randomly applied in few places during the very first implementation of createList, but apparently without any real schema: in certain places it was added, in others it was not.
So, unless anyone has any objection, I'm going to drop them all and go for the "without strtr" version.
Okay, few months after I have the prototype up and working locally.
It doesn't come with any configuration yet (not even the "enable") is not yet completed because I replaced only the potentially bot-facing urls in the controllers and subs (still have to touch the template) and is probably buggy, but it's a start.
I went for:
index.php?b/{boardname}-{id}/page-{number}
index.php?t/{subject}-{id}/page-{number}
* index.php?p/{username}-{id}
and then after that a question mark and any other parameter.
It's yet another re-inventing the wheel kind of thing, but... well, it was easier for now to write it rather than learn how to use existing stuff. xD
Here it is the code:
https://github.com/elkarte/Elkarte/compare/development...emanuele45:semantic_urls?expand=1
When the templates will be done I'll send the pull request. If anyone is interested in helping with this, it may do with some testing (and a working example of htaccess to hide the index.php? part would be very helpful! xD), and if you are interested enough to do some coding, you can send PRs to my own repo. ;)
There:
https://github.com/elkarte/Elkarte/pull/3246
Many things are missing, but at least something is there. xD
I've been preaching SEF url's for years...its the only reason I keep going back to the not ready for prime time Vanilla software. If Elk had SEF url's it would be the "bees knees" as I think they say over in jolly ol' England.
# sef engine
RewriteBase /forum/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
This seems to work in cleaning up the URL's to my forum.
Got rid of: /index.php?PHPSESSID=80b4efc14c62366ebf046e6bd9d6d09d&board=12.0
The URL's are not as good as "/welcome-to-our-forum" but better then it was! Is it OK to use this?
That had me confused too. I was looking at Emanuele's avatar, and thought, if that's a
female avatar, we're in trouble! :o
Emanuele is male. Read again please. ;)