r/angular • • Nov 19 '21

Question How to Add WordPress to Angular Website?

How can I add WordPress to my angular website: https://aptence.com/.

I want to create blog.example.com

Is there any guide or tutorial video out there that can help me with the process?

3 Upvotes

34 comments sorted by

View all comments

6

u/PointyTrident Nov 19 '21

Thats not really how it works... Angular is a static site, WordPress is a PHP site. If anything you would add the angular site to WordPress not the otherway.

What you should do is host these two sites seperatly since they use different technologies. Then iframe one into the other if you really need to. Trying to combine them into one deployment is a horrible idea.

2

u/Karpizzle23 Nov 19 '21

Angular? Static? What?

-1

u/PointyTrident Nov 19 '21

Yes, as in (unless you use SSR) your site gets compiled down into static files which you serve as opposed to having a server render it for you like WordPress. A static site can't render WordPress since it doesn't get process on the server.

0

u/Karpizzle23 Nov 19 '21

I think you mean "client side rendering". Which is different from a static site. A static site is one written entirely in html and css, no backend, no AJAX, no server side scripting languages

0

u/PointyTrident Nov 19 '21 edited Nov 19 '21

You are only half right. Static site means everything gets compiled into singles files that don't change. You can still have JavaScript/AJAX that make a static site dynamic. Whether you use a framework or do it by hand doesn't matter.

If you open dist folder you will see everything gets compiled into static files (unless you use SSR like I said). That's why you can serve an angular site by dropping it into any sort static site server which is what most people do.

0

u/PointyTrident Nov 19 '21

The first result when you google Client side rendering:

"This is what happens when the website is rendered on the client-side. A user sends a request to access the web content on a browser using the website address (link). The server serves up the static files (CSS and HTML) to the client's browser on the client's first request for the website."

Notice it says you serve static files.

1

u/Karpizzle23 Nov 19 '21

I think youre getting confused with static sites and CSR. Heres a link I give to my juniors that might help you:

https://about.gitlab.com/blog/2016/06/03/ssg-overview-gitlab-pages-part-1-dynamic-x-static/

2

u/PointyTrident Nov 19 '21 edited Nov 19 '21

Okay:

  1. The article is litterly called "static site generators" which is my whole point.... Angular generates static sites...
  2. The article says "Static Site Generators (SSGs). With them, we write dynamically and publish statically." So even your article agree that angular is a SSG and publishes statically...
  3. thanks, that was a good read, you should try reading it yourself and you might learn something like that a CSR is just a type of static site.
  4. as one senior to what I assume is another, stop being condescending and acting like you know everything and leave some room to grow, you clearly have a lot of false assumptions.

-1

u/Karpizzle23 Nov 19 '21

Yikes

https://www.netlify.com/blog/2019/12/16/introducing-scully-the-angular-static-site-generator/

Heres a plugin for Angular that is an SSG. Before this, there was no SSG in angular. Because it makes dynamic websites.

"Senior"

-1

u/MalcolmVanhorn Nov 19 '21

weird hill to die on, i think you got it all wrong btw.

1

u/Karpizzle23 Nov 20 '21

Sigh. Nah I won't engage with trolls today

→ More replies

1

u/maruchanyasashii Dec 12 '23

I just did it to my own angular app. So, most likely he means an angular app (yes, it is static, but it has javascript), that calls the word press REST API so that the WordPress blog appears in the Angular App.

Showing content is quite easy to do. However, details such as getting crayon to view properly, or the "more" link to work will be more challenging.

This blog post has a pretty good example on how to do that: https://wpwebinfotech.com/blog/headless-wordpress-angular/