Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

dumb question: how to create a page with custom HTML

TB3dock
Level 7
Level 7

I have been writing slingservlets to do backend functions, and testing with postman.

However, sometimes I need to create a test HTML page, e.g. with a form to upload a file.

In aem its easy to create pages, but you can only add text/images, you cant edit the HTML.

Looking in the project, I cant see an obvious way to create a HTML page.  Any suggestions where to look?

There are a lot of tutorials on creating pages from templates, but these dont seem to include editing HTML.  Presumably I need to write some code to create a new template with my HTML, then create a page to use that template.  I cant see how to create a template where I can defined the HTML the template uses?  

 

Or do I instead have to create a new component with a simple HTML form in it, then drop that into an existing page template?

 

 

1 Accepted Solution
BrianKasingli
Correct answer by
Community Advisor
Community Advisor

@TB3dock,

For your use case, custom HTML for local development environment & test purposes, I would suggest you create a simple component. Next, ensure your component is within a component group, so you can drag and drop the component on the page. 

Once when you have created your simple AEM component, you can go ahead and edit your existing page. Drag the component into the page. If your available component is not listed in the components sidebar, then you might want to double-check if your template policies (editable template), or allowed components (static template).

If you want to write HTML into your webpage the quick and dirty way, then you can also make changes directly into your basepage.html, where HTML will be visible on your entire local development environment. 

View solution in original post

3 Replies
BrianKasingli
Correct answer by
Community Advisor
Community Advisor

@TB3dock,

For your use case, custom HTML for local development environment & test purposes, I would suggest you create a simple component. Next, ensure your component is within a component group, so you can drag and drop the component on the page. 

Once when you have created your simple AEM component, you can go ahead and edit your existing page. Drag the component into the page. If your available component is not listed in the components sidebar, then you might want to double-check if your template policies (editable template), or allowed components (static template).

If you want to write HTML into your webpage the quick and dirty way, then you can also make changes directly into your basepage.html, where HTML will be visible on your entire local development environment. 

View solution in original post

TB3dock
Level 7
Level 7

Thanks for this. so components are easier to figure out how to write than page templates. Regarding the basepage.html, where would I find this?  in the crx editor, I see /apps/mysite/components/page which has body.html.  However, I dont think this is used anywhere. If I create a new page on our site, the only page template available is "SPA Template", which i cant find.

BrianKasingli
Community Advisor
Community Advisor
Stick to components for your basic testing requirements. In the scenario of finding your basepage.html, you must first look at your cq:Page/jcr:content node, find the sling:resourceType, and then sling:superResourceType.