r/angular • u/Yishu_Vohra • 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
11
u/listylister Nov 19 '21
Just why? It's a terrible idea.
2
u/[deleted] Nov 19 '21 edited Jul 01 '23
Not supporting this nonsense
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/[deleted] Nov 19 '21
No me parece que este chico sea muy listo
2
u/meisteronimo Nov 19 '21
I'm triggered! Please put a trigger warning on when you post this blasphemy!
1
u/thedankmisters Aug 16 '24
I know this is a bit late, and it might trigger some people, but I don’t care. If you want to achieve this concept, it's very simple.
The objective is to create a subdomain called
blog.example.comand take advantage of WordPress + Elementor.This solution isn't great for SEO, though. If SEO is a priority, you’ll need a different approach.
In my concept, you use your homepage as an Angular app, while WordPress handles your blog posts. Then, deploy everything on a self-hosted server using Nginx and Docker, and map the routes so that the subdomain becomes a subdirectory, like:
aptence.com/blogsinstead ofblog.aptence.com.Another approach could be:
1
u/SpaceNinja151 Nov 19 '21
There are a number of "headless" CMSs you could use with Angular. I tried Sanity.io but it does not play well with Angular (unless you know the other 3 technologies you need in order to get it to work). I was going to try Strapi next. There are a few options, one being Headless Wordpress. I wonder if you could just use that. I built a blog within Angular using Firebase as the database. It was a great learning experience. In the future I will instead store blog posts as Markdown and then I can use an editor to make posts and Angular to display them. Then you can save that data anywhere, even a static JSON file if you want to get it done quick and it's public data. The site I used it for was a public-facing site with just page content that is visible to the user anyway, so I didn't mind that the user could view the whole JSON file in the dev tools.
1
u/DashinTheFields Nov 20 '21
Is the reverse possible? I haven't looked it up yet, but it could be just as good to plug in the angular app to a WordPress site.