Ethics and etiquette, and permissions of posting student work to my online "teaching portfolio"
Do I need to ask the student for permission if I post their assignment without their name?


Yes, you do.

As a matter of etiquette, certainly. How do you think your students would feel if after leaving your class, they came across your website and saw that you had posted their work without asking them?

As a matter of ethics, you should not use student's work for personal gain, unless that use also serves a legitimate educational interest. I recommend that if you do this (with the students' permission), you should wait until after the course is over and the grades have been submitted, to reduce the power imbalance and so that a student will feel comfortable saying "No" to your request.

As a legal matter, possibly. At many institutions, students retain the copyright to their coursework. If the work is sufficiently creative to be copyrightable, then you are not legally allowed to post it online without the author's permission.

As a matter of policy, possibly. Your institution may have a policy forbidding this.

But even if the work is not copyrightable and your institution has no policy forbidding this, you should still ask the students for permission as a matter of common courtesy.