How to Make It
Melt butter in a Dutch oven over medium-low; add onions, salt, pepper, thyme and parsley sprigs, and bay leaves; cook, stirring often, until onions are golden brown, about 1 hour.
Meanwhile, preheat oven to 350°F. Arrange baguette slices in a single layer on a baking sheet. Bake in preheated oven until lightly toasted, 12 minutes. Set aside.
Remove and discard thyme and parsley sprigs and bay leaves from onion mixture. Add flour, and cook, stirring constantly, 2 minutes. Add broth and sherry; bring to a boil over high. Boil, stirring constantly, until slightly thickened, 2 to 3 minutes.
Layer half of the toasted baguette slices in a 13- x 9-inch baking dish. Spoon onion mixture evenly over bread. Top evenly with remaining baguette slices. Sprinkle with cheese; cover with aluminum foil. Bake in preheated oven 30 minutes. Increase heat to broil. Remove foil; broil until cheese is bubbly, about 3 minutes. Sprinkle with thyme leaves.