I agree with Kristy - don’t leave out a tray because one greedy kid will wipe the whole thing out.
I know some guests might actually enjoy sitting on the front porch and doling out candy. But with most guests not really knowing what their plans will be (out to dinner, or staying in) it would be a waste to buy all that candy - unless you eat it of course!
I wouldn’t want the kids coming all the way up to the door and ringing the bell unless someone is designated candy giver. I would stick a sign in the front yard saying “please do not disturb - no candy” - or maybe something nicer. That way kids just move on to the next house. If kids will miss the sign in the yard (due to being dark) then next best would be to put a sign where visible before they get to the doorbell.