How do I exclude blank rows with this formula?

Hello, I am currently using this formula

=JOIN("|",TRANSPOSE(SORT(A:A,1,true)))

which sorts items in column A, combines them, and adds the pipe between. If column A has this in it:

orange
apple
pie
candy
<blank>
<blank>
<blank>
<blank>
<blank>

then the result has these pipes at the end, and I would get

orange|apple|pie|candy|||||

I would like to modify the formula to only include the rows that have something in them, so in the above example, the five pipes at the end would not be there. How would I accomplish this please?