You can hardly blame Joseph for considering divorce when he discovered that, through no fault of his, Mary was pregnant. Nevertheless, when it was explained to him, he took it like a man, and all was forgiven. As soon as he got word in a dream that King Herod was planning to massacre all male babies in the neighborhood in hopes that the newborn Messiah would be one of them, he took the child and Mary and beat it to Egypt, where he had the good sense to remain till he found Herod's name in the obituary column. Later on, when they lost Jesus in Jerusalem at the age of twelve, Joseph was as nervous a wreck over it as Mary and every bit as delighted once the boy was found.
When Matthew in his Gospel records Jesus' genealogy, he traces it back through his mother's line in deference to the doctrine that the one whose son Jesus was was God. When Luke records it, on the other hand, although he was no less a true believer, he makes no bones about listing Joseph as the father of Jesus and tracing the line back through him.
Since Jesus himself never seems to have worried much about theology, it is hard not to believe that, for auld lang syne, he would have preferred Luke's version.
Matthew 1-2; Luke 2:41-51; 3:23-38
~originally published in Peculiar Treasures and later in Beyond Words