File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 55use ArrayAccess ;
66use Illuminate \Contracts \Support \Arrayable ;
77use Illuminate \Contracts \Support \Responsable ;
8+ use Illuminate \Support \Carbon ;
89use Illuminate \Support \Traits \ForwardsCalls ;
910use JsonSerializable ;
1011use Statamic \Contracts \Auth \Protect \Protectable ;
@@ -417,7 +418,14 @@ public function site()
417418 public function toResponse ($ request )
418419 {
419420 if ($ this ->reference && $ this ->referenceExists ()) {
420- return (new \Statamic \Http \Responses \DataResponse ($ this ))->toResponse ($ request );
421+ $ response = (new \Statamic \Http \Responses \DataResponse ($ this ))->toResponse ($ request );
422+
423+ if ($ updatedAt = $ this ->routeData ()['updated_at ' ] ?? null ) {
424+ $ response ->setLastModified (Carbon::parse ($ updatedAt ));
425+ }
426+
427+ return $ response
428+ ->setEtag (md5 ($ response ->getContent () ?? '' ));
421429 }
422430
423431 throw new \LogicException ('A page without a reference to an entry cannot be rendered. ' );
You can’t perform that action at this time.
0 commit comments