According to these definitions Site pages should always be Unghosted and Application pages should always be Ghosted.

Now here comes the problem:
SP virtual path provider: provides virtual path for both ghosted and unghosted site pages. How site pages be ghosted?
This MSDN link also talk about ghosting and unghosting of site pages.

Ghosted and Unghosted not a page types, it's a page state. Application page is always ghosted as you mentioned, but site page can be ghosted or unghosted (if changes have made through SharePoint Designer)
–
KaiFeb 16 '13 at 17:17

could you please refer some material to understand how and why the site pages be in ghosted state...
–
MohitFeb 17 '13 at 5:25

3 Answers
3

The Ghosting/Un-Ghosting (or if you prefer the new Term Customized/Un-Customized) makes a real difference when you consider _layouts page, wcf services, etc. in the context of the SP Virtual Path provider (which then loads the Page Parser)

Example -

A Document Workspace has a default.aspx (physical) where as Team Site
in SP 2010 has a Wiki Page (database). Therefore Site Pages can also
be physical, until you customize any of them - via SPD.

Last point on site page section of the third link shared by you says .”SPVirtualPathProvider” is the virtual path provider responsible for handling all site pages requests. It handles both ghosted and unghosted pages requests. Which again raises the same question how site pages can be ghosted.
–
MohitFeb 16 '13 at 10:38

LayoutsPageBase is good example. When any page created using this base class (also called layout pages or template pages) and if it is deployed to _layout path or any other path, it has physical presence on file system (c:\program files\common files\microsoft shared\web server extensions\xx\TEMPLATE\LAYOUTS). Then VPP creates instance of page and caches it in database.

When site pages unghosted?

When VPP loads page layouts from content database (instance of page).

What VPP (Virtual Path Provider) does?

VPP does both jobs (Ghosted and Unghosted) for single request of page. First it reads template page (ghosting), second it reads instance of page (unghosting), and then combines both parties and render the page.

Example:

I have a news organization. I have created custom page layout to list down all my news. In my company, the news publisher has responsibility to generate news list page.

Take a look at this video on building custom SharePoint Site Pages. In it I explain customized/un-customized (ghosted/un-ghosted). Since Application Pages are not put into the content database they are never ghosted.