File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -275,4 +275,13 @@ public function getEstimatedDate()
275275 new \Carbon \Carbon ($ date , 'GMT ' ) :
276276 $ date ;
277277 }
278+
279+ /**
280+ * Returns the canonical url from a page, if any.
281+ * @return string
282+ */
283+ public function getCanonicalUrl ()
284+ {
285+ return isset ($ this ->data ['canonicalUrl ' ]) ? $ this ->data ['canonicalUrl ' ] : null ;
286+ }
278287}
Original file line number Diff line number Diff line change @@ -113,10 +113,23 @@ public function getDiffbotUri()
113113 return $ this ->data ['diffbotUri ' ];
114114 }
115115
116+ /**
117+ * Returns the timestamp from the point in time the page was indexed by the engine
118+ * Example date: "Wed, 18 Dec 2013 00:00:00 GMT"
119+ * This will be a Carbon (https://github.com/briannesbitt/Carbon) instance if Carbon is installed.
120+ * @return \Carbon\Carbon | string
121+ */
122+ public function getTimestamp ()
123+ {
124+ return (class_exists ('\Carbon\Carbon ' )) ?
125+ new \Carbon \Carbon ($ this ->data ['timestamp ' ], 'GMT ' ) :
126+ $ this ->data ['timestamp ' ];
127+ }
128+
116129 protected function getOrDefault ($ key , $ default = null , $ data = null )
117130 {
118131 $ data = ($ data !== null ) ?: $ this ->data ;
119132 return (isset ($ data [$ key ]) ? $ data [$ key ] : $ default );
120133 }
121134
122- }
135+ }
You can’t perform that action at this time.
0 commit comments