Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/search-engine-friendly-url #317

Merged

Conversation

Kamyab7
Copy link
Contributor

@Kamyab7 Kamyab7 commented Dec 3, 2023

This PR closes #202

Change Log

  • Modify BlogPostId to be shorter than before (short URLs are more search engine friendly).
  • Add blog titles to the URL.
  • Modify RSS to obey new routing rules.

@Kamyab7 Kamyab7 changed the title Feature/search engine friendly url Feature/search-engine-friendly-url Dec 3, 2023
@linkdotnet
Copy link
Owner

Thanks for providing the PR to tackle the URL / Slug stuff.

I want to discuss a few points with you and get your input. I do find your approach interesting - avoiding some of the issues I had initially with the topic. My first approach was next to the page URL with a guid to allow the slug. So something like that:

@page "/blogPost/{blogPostId}
@page "/blogPost/{slug}

That said - here a few points I do think we might want to tackle:

  • The "old" approach should still work - that should be fairly easy with your implementation, but I do like the approach, because it might be completely optional.
  • More importantly, URL should be somewhat immutable. That might be a problem with your approach. If I change the title, the slug will change. That isn't very great from a SEO point of view. This would be an important feature for me here.

What are your thoughts on that?

@Kamyab7
Copy link
Contributor Author

Kamyab7 commented Dec 3, 2023

Thanks for reviewing the PR.

I agree with your first point but about the second one here are a few things we need to discuss:

Imagine we make slugs immutable and for any reason, a user writes a wrong title for the blog post even after editing the title slug is still wrong even if we consider a new column in the database and ask the user to manually fill it maybe need to be changed unless we force the user to delete the current post and create another with a correct slug.

So in my opinion we have two options:

  • Forcing to delete and recreate the post every time the user needs to modify the slug.
  • Keeping slugs mutable since edits usually happen right after creating posts and don't change regularly, for fixing minor issues search engine crawlers didn't index the post yet so I guess it doesn't have a negative impact on SEO.

What are your thoughts on that?

@linkdotnet
Copy link
Owner

That is a good point - and I don't know anymore what I did in my first draft of a "slug".
As far as I remember, I created it once, and it couldn't be changed - which goes in the same argumentation as you used. It is not very likely that the title changes dramatically.

One open point I don't have a conclusion on right now is whether or not the GUID should still be part of the URL.
It is somewhat unusual to have both - even though it would make the implementation very simple.

Currently, I am leaning toward your way of handling things. So the slug "is just a nice addition" without any impact.

@linkdotnet
Copy link
Owner

I would also remove the "URL-Friendly" link from the RSS part.
Many RSS readers only collect a content once via the Updated Tag - so it expects immutability.

Stackoverflow does the same: https://stackoverflow.com/feeds

@Kamyab7
Copy link
Contributor Author

Kamyab7 commented Dec 4, 2023

I have seen a lot of blogs that have both GUID and slug together not the least of which is www.searchenginejournal.com
if you open this URL, the URL goes like this https://www.searchenginejournal.com/malware-warnings-in-google-searches/4252/
and if you change the slug the website still retrieve the correct blog post but if you change the id another post will be displayed
as I mentioned before GUID is used to retrieve the correct blog post and slug is used to be search engine-friendly.

@linkdotnet
Copy link
Owner

I am currently a bit busy. Just ping me or request a review when I should have a second look!
Otherwise. Good job so far - we are almost there

@Kamyab7
Copy link
Contributor Author

Kamyab7 commented Dec 7, 2023

Some of the tests seem like failing I guess we should modify them to cover our new changes also we need to add some new tests to cover our new features like slug generator.

@linkdotnet
Copy link
Owner

Some of the tests seem like failing I guess we should modify them to cover our new changes also we need to add some new tests to cover our new features like slug generator.

Absolutely. I do think we need to find edge cases. An extensive suite of tests would be great.

@linkdotnet
Copy link
Owner

Really great job @Kamyab7!
Almost there - just a few edges.

@Kamyab7
Copy link
Contributor Author

Kamyab7 commented Dec 16, 2023

Really great job @Kamyab7! Almost there - just a few edges.

Happy to hear that :)

@linkdotnet
Copy link
Owner

LGTM! If there is anything open, let me know - otherwise we can merge the changes.

@Kamyab7
Copy link
Contributor Author

Kamyab7 commented Dec 16, 2023

LGTM! If there is anything open, let me know - otherwise we can merge the changes.

Let's merge it.

@linkdotnet linkdotnet merged commit 995bf7a into linkdotnet:master Dec 16, 2023
1 check passed
@Kamyab7 Kamyab7 deleted the feature/search-engine-friendly-url branch December 17, 2023 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search engine friendly URL
2 participants