Forum Discussion

Americo Perez's avatar
Americo Perez
Iron Contributor
Mar 01, 2019
Solved

SPFx how to get the current page title?

Hi,   I am trying to use SPFx and @pnp/sp to get the title of the current news page, I mean when I open a news post I would like to retrieve the title of the news post. Actually the site pages libr...
  • FedericoPorceddu82's avatar
    Mar 02, 2019

    Hi Americo Perez 

    You can try in this way, using pnpjs and listitemid (number)

       var resultData: any = await sp.web.lists.getByTitle("Site Pages")
                .items.getById(15)
                .select("Tags")
                .get();
    
            return await resultData.Tags;
                    

    Cheers

    Federico

Resources