How to change Ghost Routing to make a landing page first - pagination

I am building a Ghost Theme at the moment and I am having trouble swapping the blog for the home.
I went and created a post called "news", then change it to a static page, so I can access the slug. Then I created a "page-news.hbs" and it worked fine.
The problem is that when I add {{pagination}} everything breaks. I get a 500 with error
[page-news.hbs] pagination data is not an object or is a function
(/Users/lulato/Desktop/DD/DESKTOP/ghost_exper/jagag_exp/node_modules/ghost/core/server/helpers/pagination.js:14:23)
I'm also running the home.hbs. Not sure if that's relevant.
I checked an earlier version of this question here but it was from 2014.

Related

the contents of my website is not showing

When I deployed my react website with three fiber, the contents such as my html would show at first before the content in the div start disappearing on the live. The js would load at first and then disappear. The model did not show at all.
Here is the live site:
https://xavi4075.github.io/portfolio/
It was fine before I compiled and exported onto github. I have no idea why this is happening
the development build is currently facing the same issues as the live one .The hosted code is on the gh-pages branch. The only thing that seems to be working is the background.
I did this from gui's response
however this was the response from the live site. It is working now in the development site with the fetch being portfolio/assets/airplane.fbx. how can I get rid of the second portfolio?
The only actionable item I can discern is your model not showing up. This is because the fetch for it is returning a 404 error. I'm unsure if this is the cause of everything else not loading correctly but if you open your console you'll see something like this:
Console error
I believe if you change the fetch from https://xavi4075.github.io/assets/airplane.fbx to https://xavi4075.github.io/portfolio/assets/airplane.fbx. Your model should show up since that is where your model lives in your files.

Refreshing Angular app breaks one component, but only on version hosted on Heroku

I am working on a personal project for my portfolio and I'm completely stuck.
I have an Angular 14 app I've been working on. The stack is PEAN. I currently have a live version of it hosted on Heroku. The issue I'm running into is that in my local development version of the app, everything works as intended, however on the live version on Heroku, If I refresh the page using f5 while on the main backlog page, it does not refresh, and instead shows a blank page with "[ ]" at the top of the page. Every other part of the app functions fine, and it does not fully crash when I run into this issue. If I type a different URL in and go to that page, it works again. If after doing so, I click a link that loads the crashed component, it will reload just fine. It appears that the component only breaks if I refresh the component with f5 (or clicking the refresh button on chrome).
I've been working on this for a long time and I think I've narrowed it down a bit. So far I've:
confirmed that my express server is serving my static HTML files from their folder correctly
added a catch all code block at the bottom of my express file to redirect to index.html
made sure that Heroku was actually executing my server.js file
removed potential offending portions of code, like auth/error interceptors and newly added Google Sign-in
I've also:
checked with various browsers/mobile browsers
checked for console errors (there are none)
checked network tab on refresh. (just shows a 304-OK response)
checked Heroku logs. No errors there either.
The issue can not be recreated locally, and it only happens on refresh of one component, the Backlog component.
If there is any more info I can add please let me know, I'm hoping this is a regularly encountered issue. I can't seem to find anything that specifically deals with my exact issue by searching. Any help is greatly appreciated.
update
The blank page with "[ ]" appears to be my database's response when hit without a user ID to check against, and return data. I've narrowed this down to an HTTP-INTERCEPTOR that injects the user ID into the headers, which the route that would use that info for the DB wouldn't have. This makes my DB return "[]".
The only thing I don't understand is that this happens only when hosted on heroku, and not locally.

Making a forum using Node Express EJS and MongoDB

I am making a forum using Node, Express, EJS and MongoDB. Currently, I render the forum page and pass data from the database using Node and EJS. I use GET and POST requests. As soon as I add a comment, the page stores in the database and then redirects back to the same route. I am then able to scroll down and see my comment. However I am not happy with this and I want the comments and replies to be handled by Ajax so that as soon as I comment, without refreshing, I create a post request and again without refreshing the page I can load the new comment. Any suggestion on how can I bring this to live?
The project is available to view on https://github.com/Ibrahim40021974/Forum . (Sorry for the untidy code. Am still working on version control). All suggestions are welcomed!
Thanks in Advance.
What you wanna achieve, is generally called a single page application where you won't see the page refresh but the small component of that page is actually got updated with new data.
I have done using Reactjs, Nodejs which is pretty easy to do in Reactjs. If you are interested , I can share the repo.
Had looked into your project and few things I noted.
If I am referring the right one (https://github.com/Ibrahim40021974/Forum/blob/master/views/forum.ejs#L69) then you need to stop default form submit using e.preventDefault(). Default form submit always refresh the page which you don't want. Same form operation you have to do with ajax call.For exm.
handleFormSubmit(e) {
e.preventDefault();
// <add your ajax call here>
}
See once you do this if things work without page refresh.
See if this helps you with how to make ajax call. https://www.thetopsites.net/article/53326172.shtml
As #Ajay kumar said the best way is to create a single page app : framework like react/angular/vue are pretty good when it's about refreshing only part of your page when new data are inserted.
Yet you could do this without using any of this framework but it will be tricky.
You can, in your ejs template add the javascript logic that will, when you submit your comment, do the following :
Send a post request to submit the new comment
Send a get request to get comment affiliated to this post as soon as post request ended
update the DOM(vanillaJs or Jquery) to display the list of comment.
The first choice will ask you to change your project architecture, but will be easier to manage, the second will give you the possibiliy to keep using ejs but is a bit more complicated.

Orchard's Lost Password returning 302 and redirecting

We are experiencing some odd behaviour when attempting to POST to the Lost Password action on the Account Controller in Orchard.Users.
The important details
We are not directly using Orchard source code, we are using a compiled re-distributable and building modules that are deployed to the redist host, so direct debugging is a challenge.
We have tried this with the vanilla Orchard 1.8.1 (the version of our redist) so we can all but eliminate any of our module's code.
When POSTing the form we get back a 302 Moved response with the Location Header set to /. This then does end up to root rather than to the Success page or back to the Enter New Details password. The user's password is not successfully changed.
Looking at the Account Controller in source shows that the only result that expressly returns the root is when the the call IUserService.ValidateLostPassword(nonce) fails and the return Redirect("~/"); is called.
Seeing as direct debugging is a little complex, we acquired a copy of the Controller from source and moved the action code and all related service call logic into an Orchard command for testing. This has succeeded in changing a user's password. and returning without error, using the NOnce captured from the reset email.
So we suspect this may be a bug with Orchard itself though more likely to be with our instance and it's configuration seeing as "Cannot change password" is a pretty expansive issue.
Anyone have any advice to offer? Known bugs that may apply?
Update 1:
Thank you Bertrand. We have not tried it with Orchard 1.9 yet but did manage to get a completely clean 1.8 (as this is the version we are currently running out in the wild from with one of our repos. P.S. Are you aware that your GitHub repo braches go 1.4.x, 1.5.x, 1.9.x? No 1.8.x available. Anyway.) and this worked. The short version: we played around with what could be different and we got it down to it works when our theme is off and doesn't when it on.
A little digging showed that our FE guys has overwritten the Lost Password view to match our business look. Here is what I found:
In the default Orchard view the form is started using:
#using (Html.BeginFormAntiForgeryPost()) {
and ends up looking like
<form action="/OrchardLocal/Users/Account/LostPassword?nonce=Vc7ABvKcwfMO0jrRkJFxiBWoJzbdGAqQ7bbEgGySqlyAAKnHPTIkyhzG8nn%2FXJsqKkh6e9sreTnHx223BKFOs17gY%2FDWMggtCZw%2BSfz194Mviua5smhl5d%2FnACXCI%2BrdQaGcJj%2BjvoFE7m2OIiaX8w%3D%3D" method="post">
all fine and dandy. I presume that because the nonce came in as a query param on the get, it is persisted to the post through inference in calling the default Begin Form without any additional settings.
However, our override currently uses:
#using (Html.BeginFormAntiForgeryPost(Url.Action("LostPassword"), FormMethod.Post, new{ #class="form-lost-password"} ) ) {
Here we specify some additional class for the needs of our theme and on the page we get:
<form action="/Users/Account/LostPassword" class="form-lost-password" method="post">
The nonce has disappered (or rather has not been added at all since we are specifying an particular route). So the ready solution is the add the nonce on using the
Action(String, String, Object)
form of Url.Action() to specify it as a route value.
However, the nonce is not passed through as either a member on the Model nor through the ViewBag (like the minimum password length is).
I found this this previous question from the time of Orchard 1.6/1.7 which suggests updating the controller to add the nonce to the Viewbag but we are using a pre-compiled re-dist of Orchard so this is less than ideal for our needs.
I will be other ways of writing that form using what we have available to us without updating the Controller but is there any plan to make the nonce available to this view for use?

SharePoint 2013 REST upload from App works on image, fails on video

Has anyone tried to upload a video via REST to SharePoint 2013 from a SharePoint hosted app?
Below are my two POSTs. The first one, an image, works fine. The second one does add my video but it throws a 404 (Not Found). Subsequent executions do not overwrite but instead create new video files with some random letters afterwards. The subsequent executions also pop the 404.
I should also point out the the overwrite flag is obviously being ignored because it always creates a new file. Further when I tried to use the "manipulated" video URL that you see in a library after uploading it blows with a server error.
My suspicion is that it's because of the way SP2013 handles videos by creating items that don't retain their extension like an image does. Anyone know for sure?
Or know if there's some sort of RESPONSE that is sent back that would cause the 404?
http://app2-6040b7dbcd33cc.sp13apps-qa.PATH/sites/XDevT/CustomNewsFeedEntry/_api/SP.AppContextSite(#TargetSite)/web/lists/getByTitle(#TargetLibrary)/RootFolder/Files/add(url=#TargetFileName,overwrite='true')?#TargetSite=%27http://teamsites13-qa.PATH/sites/XDevT%27&#TargetLibrary=%27NewsFeedVideos%27&#TargetFileName=%27cg-overlay-img.jpg%27
http://app2-6040b7dbcd33cc.sp13apps-qa.PATH/sites/XDevT/CustomNewsFeedEntry/_api/SP.AppContextSite(#TargetSite)/web/lists/getByTitle(#TargetLibrary)/RootFolder/Files/add(url=#TargetFileName,overwrite='true')?#TargetSite=%27http://teamsites13-qa.PATH/sites/XDevT%27&#TargetLibrary=%27NewsFeedVideos%27&#TargetFileName=%27WMV_Movie.wmv%27

Resources