Welcome Guest, Not a member yet? Register   Sign In
New World Frontend Order - how Codeigniter fit in a javascript frontend world?
#1

Hello. I have a very important question.

I upgraded Codeigniter from 3 to 4 and it feels wonderful... but I'm asking myself. Is it born already old?
In the MVC world, the View part nowadays is done via javascript frameworks. The lack of SEO is done by prerendering throught Nodejs and things like that.
What codeigniter can propose?

What can I do to use codeigniter AND javascript frameworks without relying on nodejs to delirer prerendered pages?
I saw that Laravel use prerender.io, can something like this be done with codeigniter?
I saw Phoenix with LiveView thinking something other entirely but that fits the bill.

There's something that I'm missing? Whats your thought or your strategy about this?

Thank your for your attention.  I'm very confused right now so I don't know if I expressed myself correctly.
Reply
#2

Not all websites or web apps needs a fancy javascript interface. But if that’s what you want, nothing stop you from making all the front end with your favorite JavaScript framework, like Angular for example, and the back end with CodeIgniter for a all the ajax calls.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
Reply
#3

Well, SEO stop me. Without SSR (and that need Node, not PHP) the page will be blank. Google seems to understand a little, but other engines no.
Maybe I just need to wait for crawlers to catch up, but in the mean time I have to make serious decisions.

I know that Codeigniter is not at fault, but I just don't know what to do...
Reply
#4

I’m not following you. You say something like Angular, which is made by Google, will be seen as a blank page by Google and other search engines? That doesn’t make sense.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
Reply
#5

When you put yourself in a box by following trends and advice, then you will come here and ask this question. With experience you will be able to do what you want, with maximum efficiency, maximum maintainability, and maximum flexibility. One man’s view generated by JS is another man’s Ruby on Rails!
Reply
#6

(04-08-2020, 02:57 PM)includebeer Wrote: I’m not following you. You say something like Angular, which is made by Google, will be seen as a blank page by Google and other search engines? That doesn’t make sense.

It's not about who makes it. If you run any javascript framework without SSR, google will see a blank page. There have been improvements over the last few years regarding how well the Google crawler parses JS, but at the end of the day, if you're loading your app on the client side, google won't see much.

Something like "Nuxt" in the Vue world is what makes up for it. I'm sure Angular has an equivalent.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#7

Exactly.

But the problem with Nuxt and Angular Universal (and all other equivalents), is that for dynamic pages (like a product page) you must render them on the fly, and for do this you need Node.
And, even if they are not much, there are other crawlers who matters and they are not advanced as google.

I'm understanding that this is a transitional problem. Everything is for SEO's sake and the problem will slowly disappear... (not so slowly I hope)
Reply
#8

I’m no expert in Angular but you don’t need Node to run an Angular web apps. After you transpiled the TypeScript code you are left with standard JavaScript, HTML and CSS files that can be served by any web server. Also, when you navigate in the app, the URL changes. If you go directly to that URL, the right HTML page is rendered. So why would Google see a blank page? I would be surprised the Google engineers didn’t think about this when they designed Angular.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
Reply
#9

(04-08-2020, 06:41 PM)skunkbad Wrote: One man’s view generated by JS is another man’s Ruby on Rails!

Bravo Brian. Well said.
Reply
#10

(This post was last modified: 04-10-2020, 12:34 PM by albertleao.)

@includebeer is right.

You do not need a node server to run Nuxt. I assume it's the same with the other equivalents.

With Nuxt at least, you have the ability to run the Nuxt Generate command which will generate all your routes into html pages with the correct js and css required. I currently have this wired in my CI 3.0 app so that codeigniter knows which html pages to serve after they've been generated. Works pretty flawlessly and I still get the SEO benefits.

(04-09-2020, 01:33 AM)shinseiten Wrote: Exactly.

But the problem with Nuxt and Angular Universal (and all other equivalents), is that for dynamic pages (like a product page) you must render them on the fly, and for do this you need Node.
And, even if they are not much, there are other crawlers who matters and they are not advanced as google.

I'm understanding that this is a transitional problem. Everything is for SEO's sake and the problem will slowly disappear... (not so slowly I hope)


As I mentioned in my post above, there IS a way to do product pages without a node server.

You can create dynamically generated routes in Nuxt with server generated html pages. This includes routes for something like "/product/some-product-name-or-id". Then you set your servers to periodically regenerate those pages. If your api is decoupled from your front end, it should be pretty easy. The downside of this approach is that product pages will be delayed to update based on how long your interval is.

I have this above system running across a few dozen servers regenerating once every 30 or so minutes and it's worked pretty well.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB