Q: I just enrolled my child in our state's 529 savings plan. How should I allocate the money I contribute?

Generally speaking, most 529 savings plans are set up like 401(k) plans. There are some rather aggressive investment options, which are generally stock-based, and then there are some more conservative options with greater emphasis on fixed-income investments and cash equivalents such as money market funds.

A good rule of thumb is to approach 529 plan investing like you would your own 401(k), but with your child's college entrance date in place of your retirement date.

In other words, if your child is eight years old and plans to go to college at 18, this leaves a 10-year investing time frame, so you can afford to take some risk, knowing that if your investments go down in value, there's ample time to recover.

On the other hand, if your child is 16, they'll need the money to go to college in just two years, so you probably want to be a bit more conservative. This doesn't mean that you should get out of stock-based investments completely, but since capital preservation becomes more of a priority, your portfolio should definitely be more cash- and bond-heavy. After all, the last thing you want is for a stock market crash to cut your child's college fund in half the year before they're planning to start school.

Fortunately, many 529 plans make it easy for you. Many actually have age-based portfolios, which will automatically adjust your investments as your child gets older. Others offer portfolios with names like "aggressive growth," "moderate growth," and "conservative," and the general rule of thumb is that you should gradually shift from the more aggressive options to the more conservative ones as your child gets closer to college age.

The Motley Fool has a disclosure policy.