Whenever we create sites based on our custom site template, and after the creation completes, I got this error:
“Only Content controls are allowed directly in a content page that contains Content controls”.Note that all internal pages were working fine (Site Settings page, All site content page,….etc).
So finally it was a problem caused by Page Layouts, also some page layouts were working fine and some are not.
I opened the corrupted page layouts in SharePoint Designer, and found that below lines have been appended to the end of the page, and if I remove them the corrupted page layout works fine !!!!
Still one thing to do !! what caused this generated code to be appended? so I made a comparison between corrupted layout pages and the working ones, I found just below difference:
All letters in above two tags were written in lowercase, and after change them back as in the above ones (capital 'C' in "Content"), and tested the above scenario again (created same sites again), everything worked fine and I never get this error again.