When installing a rear rack, should I attach the struts to the frame or the seat post on my small bike? For context, the bike is a small Giant Liv Alight and the rack is a Transit Rear Rack which carries up to 40 lbs. 

The distance between the mounting eyelets on the rack and the ones in the frame is about 8," while the rack-to-seat post distance is a little less.  There are struts (attachment arms) for sale which are 11". 

I plan to carry close to the 40 lb maximum.  Considering the weight, would you recommend mounting the rack to the frame or the seat post?  (As a city hybrid, this set up is a downgrade from the stronger, heavier set up on my touring bike.)
From rack strength perspective it doesn't make much difference. Most of the weight is going straight down to the rear dropout. The front connection is mostly for stability and isn't bearing much weight.  



From the seatpost's perspective, it's already carrying 150+ pounds (75kg+) of the rider. Another few pounds is nothing. (Note that racks that cantilever off the seatpost are another issue and they can put undesirable lateral force on the seatpost). 

The only problem in attaching it to your seatpost means that it'll be harder to adjust your seatpost. One benefit though is that means it's a tad bit harder to steal your seat.