How to get entity in sidebar ?

I want to put related post  in page/elements/sidebar , and i need entity/guid of the current page

but i don't know how to do it

for example

i open http://localhost/hahaha/file/view/71/hbhjb

the guid is 71

but how to get '71' automatically?

i have tried to use $vars['entity'] and it doesn't work. is there some tricks to do this ?