How to show a preloader when LANDING on a NextJS page? - next.js

Yes, I know you can do it using the built in router of NextJS, but how do you make it so it shows a loader when you LAND (NOT WHEN CHANGING ROUTES) on the page? For example I perform a reload or I open a new tab and type localhost:3000 to visit the local version of the website. The NextJS Router does not fire events when you land on the page from another website thus the loader does not appear, all you see is the page loading each component. I really hope I am well understood!

Related

When editing Additional CSS in WordPress webpage redirects to Homepage

I am having a weird issue I can't figure out. I am creating a SaaS App for a client using WP as the framework. I am creating shortcodes to place the content/code on each of the pages. The FrontEnd Dev is having an issue when they select a page to edit the Additional CSS in Customizing, as soon as they hit any key on the keyboard the page automatically redirects to the Homepage of the site. But it is not redirecting like when you click on a link, it seems like it just automatically replaces the shortcode content with the Homepage shortcode. It's really weird.
It doesn't matter what page I am on it will do it. Even pages where I don't have a shortcode on it, it's just a blank page. No errors in the console.
The actual SaaS App when not viewing it from the CMS of WordPress works just fine with no problems.
Any ideas?
UPDATE
I have been spending hours on this and I have just discovered the issue, problem now is that I have to figure out why it's doing it. Here is my update.
In my application I have some <a> (Links) that I code in using either window.location.href or window.location.replace. Using the app from the front-end there are no issues at all. BUT If you go to customize the theme from the WP Backend whenever you hit a key on the keyboard in "Additional CSS" it causes the site to go back to the previous page you were on when clicking a link that uses the redirects I mentioned. If I hardcode those links without using code then nothing happens and the pages do not redirect as intended. So the issue has something to do with using the coded redirects. I know when customizing a theme WP updates those changes live. I can see in console admin-ajax.php being called when editing the CSS. That is what I have so far.

trouble implementing SEO correctly in next.js app using next-seo

I am using next-seo to implement seo in my next.js app. This app uses feather.js in the backend api.
I have implemented a default seo config in _app.js file as per the instruction. I need to override this in the users' dashboard with user info, but this info comes from the feathers.js backend api. so it's fetched asynchronously.
I fetched the info in ComponentDidMount.
What baffles me is that much as the overrides are reflected when I go to the users dashboard, when I view page source on the page in the dashboard, the override is not reflected. the metatags and title in that html remain the same as they were in pages like the landing page which never overrode the seo.
what should I do to fix this?
my code snippets
Big up to Erik Condie. He gave valuable information on how to avoid this error in this issue.
https://github.com/garmeeh/next-seo/issues/58

How to create routes that loads up a new page

Newbie to this entire web development domain.
I have a main page and a registration page. Whenever I navigate to subscription page I find the contents of registration page appended at the bottom the main page. How can I create routes in a way where both pages are separate. So when I click home I only see my main page and when I click registration I only see the registration page.
Thanks in advance.
You can use routing on the server side to serve a separate html page. It can be useful for landing pages, etc.
Usually it's done in Meteor by passing a middleware to connect npm module which is accessible in WebApp.connectHandlers or you could use Iron-Router's server-side routing feature.

Google Analytics: 100% Drop off from landing page

I have a Web site built in Drupal 7 - we'll call it website.com. Outside of that site, I have a campaign specific landing page - we'll call that website.com/landingpage. On this page, there are a couple of buttons back to the main website (website.com). I have goals set up that track a user from that landing page, back to the main site home page, then through a few other steps. for some reason, even though I know users are clicking through to the site, I'm getting a 100% drop-off from the landing page to the main site...
...anyone have any thoughts as to why this is?
Is it a dynamic webapp? Is the routing is handled in the client and not on the server side?
If it is a dynamic webapp and routing is handled in the client, then GA won't track your pageviews automatically, and you have to do it manually. https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications
If you are using angularjs you can use this great tool:
http://luisfarzati.github.io/angulartics/

How to link to specific page on website with custom tab

Now that the App Profile Page is no longer available, I tried using this link provided by Facebook to open a specific file on a WordPress website to the custom tab:
http://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&redirect_uri=YOUR_URL
This worked well for yoururl.com/ (main directory) which is also the index.php home page of the website. However, when I attempted to use a custom tab to connect to a different page on the site, such as yoururl.com/about/ I received the dreaded 191 error message:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
The workaround I ended up using was to copy the source code of the page by hand and create a new standalone HTML document, but I would really rather have the custom tab open the actual page so my client can update the WordPress herself without me having to edit the HTML for small changes.
Any advice?
I think your Facebook app settings may not be correct. Your site url should be the url to your main website domain homepage, eg http://www.domain.com Then your canvas url should be a link to the page you are trying to pull in, eg http://www.domain.com/facebook-tab
It should be as simple as that....fingers crossed
I am not a developer, but have been reading about building a custom app for my business page. I read that the url needs to be from a secure page url (https). Hope that helps.

Resources