linkdotnet / Blog

A blog (engine) completely written in C# and Blazor. It aims to be a simple use and easy to extend platform. Blogposts are written in Markdown and are rendered to HTML. This gives all the flexibility needed to express yourself but also have an easy way of creating posts in the first place.
https://steven-giesel.com/
MIT License
287 stars 51 forks source link

Feature/search-engine-friendly-url #317

Closed Kamyab7 closed 9 months ago

Kamyab7 commented 10 months ago

This PR closes #202

Change Log

linkdotnet commented 10 months ago

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:

What are your thoughts on that?

Kamyab7 commented 10 months ago

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:

What are your thoughts on that?

linkdotnet commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 9 months ago

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

Kamyab7 commented 9 months ago

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

Happy to hear that :)

linkdotnet commented 9 months ago

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

Kamyab7 commented 9 months ago

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

Let's merge it.