From d1596e4efd940449f3b215da5d7bef94e0944931 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Fri, 27 May 2022 16:13:27 +0200 Subject: [PATCH] client modules example: log document.title to see bug in action https://github.com/facebook/docusaurus/pull/7424 --- website/_dogfooding/clientModuleExample.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/website/_dogfooding/clientModuleExample.ts b/website/_dogfooding/clientModuleExample.ts index 01b2d8250631..cd61e5a99e81 100644 --- a/website/_dogfooding/clientModuleExample.ts +++ b/website/_dogfooding/clientModuleExample.ts @@ -13,10 +13,16 @@ function logPage( location: Location, previousLocation: Location | null, ): void { - console.log(`${event} -Previous location: ${previousLocation?.pathname} -Current location: ${location.pathname} -Current heading: ${document.getElementsByTagName('h1')[0]?.innerText}`); + console.log(event, location.pathname, { + location, + prevLocation: previousLocation, + heading: document.getElementsByTagName('h1')[0]?.innerText, + title: document.title, + description: ( + document.querySelector('meta[name="description"]') as HTMLMetaElement + )?.content, + htmlClassName: document.getElementsByTagName('html')[0]?.className, + }); } export function onRouteUpdate({