Giter Club home page Giter Club logo

Comments (10)

mbaxter91288 avatar mbaxter91288 commented on July 19, 2024 2

Is there any reason to not include this into the plugin be default? Perhaps on the Post.php component?

from blog-plugin.

daftspunk avatar daftspunk commented on July 19, 2024 1
function onEnd()
{
    if (!$this->post) return App::make('Cms\Classes\Controller')->setStatusCode(404)->run('/404');
}

Should work

from blog-plugin.

rodrigogoncalves avatar rodrigogoncalves commented on July 19, 2024

@daftspunk, is there a reason for this? Why did you decide to return a 200 response in such a case?

from blog-plugin.

LukeTowers avatar LukeTowers commented on July 19, 2024

@rodrigogoncalves I suggest creating a new issue for this, would probably get it looked at faster

from blog-plugin.

mdsaicom avatar mdsaicom commented on July 19, 2024

this issue persist in 458 version

from blog-plugin.

LukeTowers avatar LukeTowers commented on July 19, 2024

@mdsaicom @rodrigogoncalves @mbaxter91288 feel free to submit a PR with @daftspunk's recommendation.

from blog-plugin.

nozreh avatar nozreh commented on July 19, 2024

I think the reason here is to have full control over how to handle the response or page in case the blog post does not exist. In my case, I don't want a 404 redirect instead, I want the user to know that the blog does not (no longer) exists then I can suggest other blogs for further reading.

from blog-plugin.

LukeTowers avatar LukeTowers commented on July 19, 2024

@nozreh while adding the 404 handling to the plugin may (temporarily) break that use case for you, I think it's probably worth doing. You'd still be able to have that custom handling if you so desire, but the point is that the post doesn't exist so it should be returning a 404 response. If that response happens to include helpful links to other blog posts that's fine but the key response should still be a 404.

from blog-plugin.

nozreh avatar nozreh commented on July 19, 2024

@LukeTowers for me it's fine as long as I can still do custom handling but I find it odd if that is the case because at the end of the day the blogPost is still a component and it'll be a bad design at least for me if a "component" decides on what response the whole page should return. If 404 is needed then I'll handle it in the page life cycle (like what daftspunk suggests) but then again that is just my use case.

from blog-plugin.

LukeTowers avatar LukeTowers commented on July 19, 2024

@nozreh I agree with you generally that a component shouldn't really dictate what the response of the page is, however it's a little bit more of a grey issue when you considered the intended use case of this blogPost component, it's entire purpose is to basically provide that response in the form of a blog post returned from the DB. It's not like it's a signup form or some other smaller component that is meant to form a piece of the overall page experience being delivered to the user, it's meant to be the main part of the response.

Perhaps a good compromise would be to have the component have a "Return 404" property of some sort that triggers that behaviour?

from blog-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.