cloudscribe / cloudscribe.SimpleContent

A simple, yet flexible content and blog engine for ASP.NET Core that can work with or without a database, supports markdown or html editing
https://www.cloudscribe.com/docs/cloudscribe-simplecontent
Apache License 2.0
335 stars 65 forks source link

Editing a blog post doesn't work #172

Closed godefroi closed 7 years ago

godefroi commented 7 years ago

I've got the SimpleContent starter kit set up (SimpleContent+SimpleAuth+NoDb), and while I can successfully create a blog post, I cannot edit one. The editor comes up empty. If I fill the editor fields out, a new blog post is created.

joeaudette commented 7 years ago

It works for me.

Did that problem happen after publishing? Can you edit newly created posts?

Given that NoDb is file system storage there can be issues if you create content on one machine and then move it to another machine ie publishing it, then the file permissions on already existing files can cause a problem on the new machine, you may need to fix permissions on those files. But I would expect newly created file to be editable.

The user that is the identity on the application pool needs full control over all files and folders starting the the nodb_storage folder.

joeaudette commented 7 years ago

are you clicking the pencil icon on an existing post page or the plus icon which is for new posts?

godefroi commented 7 years ago

Yes, I'm clicking the pencil icon on an existing post. The URI of the edit page suggests that I should be editing an existing post, but the page comes up empty.

This is all on my development machine; I have not published the site or moved it anywhere.

joeaudette commented 7 years ago

you mentioned in another post that you changed the routing. The right way is to implement and inject your own IBlogRoutes so that internally the blog knows about the correct routes that you want. You can see the default implementation here.

make sure you add yours to services before the default one by putting it before the line for services.AddSimpleContent, like this:

services.AddScoped<IBlogRoutes, YourCustomBlogRoutes>();
services.AddSimpleContent();
joeaudette commented 7 years ago

you should also remove this line:

routes.AddStandardRoutesForSimpleContent();

and instead add your own routes, with a similar method, you can see the code to copy and modify for your purposes here

also I hope you recently got the starter kits because there have been recent changes in the starter kits

godefroi commented 7 years ago

I've reverted the routes to the default, and the issue still occurs.

joeaudette commented 7 years ago

I cannot reproduce the problem using the latest version of that starter kit https://github.com/joeaudette/cloudscribe.StarterKits/tree/master/SimpleContent-SimpleAuth-nodb

joeaudette commented 7 years ago

what operating system are you on? are you using VS 2017 or VSCode?

godefroi commented 7 years ago

VS 2017.

joeaudette commented 7 years ago

are you using the latest version of that starterkit? can you reproduce the problem if you download a new copy?

godefroi commented 7 years ago

I can't reproduce with a newly-downloaded version. Clearly there's something I've changed here which has messed it up. Is there any sort of logging or other way to troubleshoot it?

joeaudette commented 7 years ago

I would first check for js errors in the page using web browser dev tools if you run vs in debug mode you should get log output in the output window if you use dotnet run from the command line you should get log output in the command window

joeaudette commented 7 years ago

I recommend copy the project to your own github or other source repository so you have good change tracking as you make changes

joeaudette commented 7 years ago

it is "possible" that a bug existed that I did not know about but that has been fixed in recent changes to the starter kits, so if you downloaded it a while back that could be the difference

godefroi commented 7 years ago

The two versions I have here (one I modified, one I didn't) were downloaded last week, at the same time (I was troubleshooting a different issue caused by my bad reading skills).

Turns out this particular issue was caused by having the "default" route mapped before any of the cloudscribe-specific routes. Once I put them in the correct order, it works!

Now, one more question (and I know this isn't the place, but...) how do I make the blog the root of the site? I'd like the blog at / and pages at /pages (or hey, at / as well). Is this sort of thing possible?

joeaudette commented 7 years ago

I think I answered that in your other issue https://github.com/joeaudette/cloudscribe.SimpleContent/issues/173 if you still have questions on that, continue the discussion there. I will close this issue now