Uwazi: Suggest Page URL based on Heading

Created on 20 Sep 2016  路  9Comments  路  Source: huridocs/uwazi

Right now the URL is created as a long string, for example "http://friedhelm.uwazi.io/page/4db5883ef6e4fc7cdbcdf8f7150888d8" and it may be preferable to suggest a link based on the heading, e.g. in this case "http://friedhelm.uwazi.io/page/about-this-collection". Makes it easier for users and should help with search engine optimisation.

Good First Issue Low

Most helpful comment

Adithya and I will be tackling this issue!

All 9 comments

We are well aware of that. We are currently under pressure for a very tight deadline and needed to release the functionality ASAP.

We will revisit this and other features when things are more calm.

Thanks!

Shall I close?

This could be a quick SEO win if we simply add the friendly URL title at the end of the URL while keeping the document id hash. This will have no impact in routing etc and is easy to implement.

Having friendly URLs improves both user experience and SEO, since search engines give some weight to the keywords being contained in the URL string. So instead of having this kind of URLs:
https://demo.uwazi.io/en/entity/mafumazsdaohb8qdwqwr8uxr
We could have:
https://demo.uwazi.io/en/entity/Burundi_journalist_acquitted_of_treason_charges

Doing this the right way poses some challenges:

  • You need to persist a map of correlations between the friendly URLs and the actual id.
  • The table needs to keep a historical, so if a title changes, the old URL is redirecting to the new with an HTTP status of 301 moved permanently.
  • The conversion from the actual title, ie. "Burundi journalist acquitted of treason charges" into the friendly segment "Burundi_journalist_acquitted_of_treason_charges" needs to support URL allowed characters for languages other than english, and replace the non-allowed ones by URL encoded chars or underscores, etc.
  • You need to keep track of duplicates, since 2 different pages could have the same title, of even, the transformation into a friendly URL could be the same for two different titles after sanitization.

Some people solve this in a hacky way by appending the friendly URL segment after the id, so that:
https://demo.uwazi.io/en/entity/mafumazsdaohb8qdwqwr8uxr
becomes:
https://demo.uwazi.io/en/entity/mafumazsdaohb8qdwqwr8uxr/Burundi_journalist_acquitted_of_treason_charges

This approach has many advantages:

  • Quick to implement.
  • You don't need to keep a historical because the friendly title is being ignored when it comes to resolving to the actual id of the page. It is there just for friendliness.
  • You don't need to flag the title changes as "301 moved permanently" since the title segment is being ignored and the id is always the same.
  • You don't need to store the friendly title anywhere in the database since it can be converted on the fly and it doesn't matter if the sanitization algorithm changes.

The only drawback that I can think of is that you keep an ugly "mafumazsdaohb8qdwqwr8uxr" in the middle of the URL, which may be acceptable?

This issue could be extended to not just pages, but also entities and documents.

Adithya and I will be tackling this issue!

@txau which are those places where the friendly segment will be calculated on the fly? The only places I can think of is the menu items and the "View page" link in the editor.
Can you think of any other?

EDIT:
Excuse the confusion. Actually the menus use links inputed by hand so the only place where the slug should be generated is on the page views.

@fnocetti the initial scope of this issue was just for pages.

@fnocetti the initial scope of this issue was just for pages.

Yeah, I was thinking about the impact of the pages urls. Having a friendly slug is also useful if search engine crawlers can index them and users can see the links. So I was thinking of how that would impact the menu items, but there's nothing to do actually.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

konzz picture konzz  路  6Comments

danicatalan picture danicatalan  路  7Comments

fnocetti picture fnocetti  路  4Comments

txau picture txau  路  5Comments

RafaPolit picture RafaPolit  路  5Comments