Comments (10)
Is there any reason to not include this into the plugin be default? Perhaps on the Post.php
component?
from blog-plugin.
function onEnd()
{
if (!$this->post) return App::make('Cms\Classes\Controller')->setStatusCode(404)->run('/404');
}
Should work
from blog-plugin.
@daftspunk, is there a reason for this? Why did you decide to return a 200 response in such a case?
from blog-plugin.
@rodrigogoncalves I suggest creating a new issue for this, would probably get it looked at faster
from blog-plugin.
this issue persist in 458 version
from blog-plugin.
@mdsaicom @rodrigogoncalves @mbaxter91288 feel free to submit a PR with @daftspunk's recommendation.
from blog-plugin.
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.
@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.
@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.
@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)
- Error installing Stormseo
- Upload Error - Server responded with 400 code. Featured_image HOT 1
- Version 1.4.3: Doesn't manage published_at date
- Preview blog button HOT 4
- Change data range to blog V1.2.2 HOT 3
- Text cannot contain '&' HOT 1
- Categories translated slug issue HOT 6
- Endless saving HOT 1
- Update hint for documentation HOT 1
- "Uncaught TypeError: a.indexOf is not a function" error occurs while trying to upload image HOT 1
- Posts list sql issue after update to OctoberCMS 3.1 HOT 1
- Markdown editor translation issue HOT 1
- No localization for buttons in Editor for Blog pages HOT 4
- Import not working
- posts by author HOT 1
- Url doubles for post pages with categories HOT 1
- Setting page title as post title using onEnd() not working HOT 2
- Override image upload to post to cloudinary? HOT 2
- Category not found HOT 3
- partial model missing _field_mlricheditor HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog-plugin.