If I was learning to code again and wanted to compile a reasonable portfolio that would successfully demonstrate my skills to an employer, I would put together something like this:
Front-end: I would lean JavaScript/React/Next.js if I was starting over in the front-end exclusively. Even though it's saturated, it presents more job opportunities, by far, than other front-end technologies like Vue and Angular.
Back-end: You could go in a number of directions here. Python is always a good bet. If DevOps, then Python/AWS is a good combo. If web, then look at Django and API development like FastAPI or the Django API. Other frameworks are good as well like C#/.NET, and of course, anything with the Node.js runtime. Be sure to understand MVC, OOP, and a surface understanding of SOLID principles. For freelancing, you could carve a niche out with the above technologies, but probably PHP and WordPress are still your hot-button items and may get you more opportunities. E-commerce, even more so.
Other considerations could be Golang in the DevOps/Platform Engineering/SRE space. It's used for a lot of microservices and is very big in Kubernetes/Docker circles. We use it exclusively where I work, it's fast, typed, and compiles.
Another consideration could be going all in with Data. Learn databases really well and handling of data and you could go the corporate route or freelancing.
Having said all this, the goal is to get better at coding principles and reading documentation such that you can shift between languages and technologies. This comes with time and will show up when you're least expecting it.
Overall, though, your portfolio will probably serve more to get you to the interview than to be talked about in the interview. Aside from preparing for all the random questions you will get in the interview, the key is to pass the coding exam.
Many companies will give you a choice of a handful of programming languages that you will use. This is a good thing. Pick one before this stage (obviously) and do algorithm practice. Make it a weekly routine while you are in the "looking" phase and into the "interview" phase. This can be practiced on many sites from Free Code Camp to Codewars (free) to Leetcode (paid).
Be sure you know the more popular ones as you will probably see at least one. (Yes, my last job used FizzBuzz as 1 of 4 questions).
What does your portfolio look like? What is your experience with searching for jobs, technology, and everything in between? What is your plan? Let's discuss.