You could land at every airport you pass along the way, and it still wouldn't stop you from logging cross country time as long as at least one of the airports you land at is the required distance from your original point of departure. You could even do pattern work during the flight, or fly way out of your way during the flight, and it would all still count as cross country time. Here's why:
14 CFR 61.1 excerpts:
[emphasis added]
So if you land at ten airports during the flight, and one of them is 50 nm or more from the original point of departure, then the flight "includes a point of landing that was at least a straight-line distance of more than 50 nautical miles from the original point of departure."
Note that there's no stated requirement to take the shortest route, no prohibition on landings at other airports, and no limit on the number of landings made during the flight.
As others have mentioned, one of the sections I left out omits the 50 nm requirement for purposes other than those listed above, for example when applying for an ATP certificate, so some log books include a column for cross country time that is at least 50 nm, and another column for all cross country time regardless of distance.