Is there a way to upload html pages into AEM DAM - html

We have bunch of help web pages(Static). We are just uploading to siteadmin using a third party tool. Is there a way to manage them in DAM?

I remember that in older versions of AEM < 6.1 the uploaded static html pages also can be rendered as normal cq pages when accessed by the uri with the content paths. But from AEM 6.1 onwards because of the security reasons this feature has been disabled(which required some Felix configuration modification to re-enable it).
Security concerns:
1) There might be a chance of uploading a malicious files which can
damange the functionality of the website/system
2) Access these
uploaded files via content URL, might have a chance of files gets
executed in AEM (some sort of scripts execution) which can damage the
system/functionality. Etc.
Just to give you some idea how we can add the static html into AEM DAM
i have the below static html (simplestaticpage.html) which is uploaded into DAM path /content/dam/geometrixx-outdoors/simplebanner/ but when i access it via the content path url http://localhost:4502/content/dam/geometrixx-outdoors/simplebanner/simplestaticpage.html it will download as binary because of the default behaviour of the AEM DAM content Disposition
restrictions.
To enable the DAM static pages to render as normal cq:pages you need to remove the text/html mime types from Dam Safe Binary Filter(com.day.cq.dam.core.impl.servlet.DamContentDispositionFilter) as shown below.
After removal of this mime type from configuration, when i access the url http://localhost:4502/content/dam/geometrixx-outdoors/simplebanner/simplestaticpage.html the page renders fine.
Note: Also remember if this doesn't work you might require to add
Content Disposition Paths the in Apache Sling Content Disposition Filter
~ Hope it helps.

AEM Design importer does uploads html pages. You can create your own HTML pages independently and use it within your application.
https://docs.adobe.com/docs/en/aem/6-1/administer/personalization/campaigns/extending-the-design-importer-for-landingpages.html

Related

How to create a W3C-validation-link for local files?

I have some local (self generated) HTML files. I view them in browser via file:// without a local webserver.
I would like to have a link in the footer of each of this files to "Validate" them on the W3C Validator. On some websites I see the links like this in source
<p class="validation">Validate</p>
But of course this doesn't work because there is no referer about local files.
I was asking this on ProWebmaster but the question was out of scope there.
EDIT: File Upload to the validator website via its web formular is not an option. I would like to send the whole HTML source to the validator without any external tools.
Validate
You can't.
The was the referer link works is to tell the validation service to look at the Referer header to get the URL to the previous page. Then to request that page and validate it.
Even if there was a Referer header for your local file, there is no way for the validation service to access it. It would be a serious security problem if every website you visited could read files from your hard disk freely!
Use the file upload feature to validate files without a public URL.
Alternatively, consider using a local validation tool and possibly looking for an extension to your IDE that makes it more convenient to access (such as this extension for VS Code).

Vue-Nuxt: Why can't I see the generated HTMLs correctly?

So when I type npm run generate Nuxt generates my project into the dist folder. In that folder I can find a folder called _nuxt where I have .js files and the index.html file but when I open it in a browser it doesn't show anything.
So, my question is: Aren't those static files?
When you work with the CDN served vue.js you have the html file and you click and everything is showed on the browser because those .html files are static, they don't need an internal localhost server. Why npm run generate doesn't do the same? Or how can I see those generated files?
As #aljazerzen explained, Vue,js doesn't do SSR out of the box, one of the aims of Nuxt.js is to provide SSR for you, as a benefit you can also generate a static version of your website. If I get what you want correctly, what you want to do is that when you open your index.html (the one that Nuxt.js generates for you) you can see your functional webpage. When you're accessing your website as a file:/// url, your browser (at least I've seen it happen with Chrome) doesn't load your .js files.
I don't have any Nuxt generated websites at hand so I can't tell you exactly why this happen. But this is my guess: when Nuxt generate those files it gives them a src that can't be accessed as file:///, maybe something as /your_js.js, that when it tries to load it, thinks it's the / of the root folder instead of relative to your website's root (/).
The solution to this problem is to serve your assets using any web server. According to Nuxt.js's documentation:
nuxt generate :Build the application and generate every route as a HTML file (used for static hosting).
You could do a quick test and use a simple web server by typing:
python -m http.server
In the folder that contains your generated assets.
Hope this helps!
Nuxt uses server side rendering.
You can read more here.
To generate static HTML files, run:
nuxt generate
Explanation: Vanilla Vue.js application is rendered only when the page loads and JavaScript can start running. This means that some clients that do not have JavaScript enabled (web crawlers) won't see the page. Also for a brief second before Vue.js can render the page, there is blank screen, when plain HTML files could already be visible.
Now, server-side rendering (SSR) is a technique for rendering a single page app (SPA) on the server and then sending a fully rendered page to the client. The client’s JavaScript bundle can then take over and the SPA can operate as normal.
This can also help with SEO and with providing meta data to social media channels.
But on the downside (as you mentioned), such application cannot be hosted at a CDN, since you have to have a Node.js process running to render the page.
In my opinion, SSR is redundant with SPAs if what you are building is actually an application and not a website. A website should mostly display information and should not be interactive. It should leverage web-based mechanisms such as links, cookies and plain HTML with CSS. In the contrast, web application (eg. Vue.js application) should be more like a mobile application: it is larger to download, but performs better and offers much more interactive experience. Such application does not need server-side rendering, since we can wait for it to load a bit more and because it shouldn't be indexed by search engines (it is not a website).

How to not load Index.html?

When a website doesn't have an index.html file, the navigator displays an auto generated page right ?
Here is an example of what I mean.
This page is very handful to explore a website, but sadly it is only displayed when there is no index.html page.
Is it possible to access such a page on a website, even though index.html exists in the folder ?
I'm using Opera, but I have tried other navigators and none of the common ones seems to do what I want ^^
Thanks for reading
This is not an auto generated page. It is directory browsing of server which can be enabled/disabled through server control panel (or using .htaccess in linux servers).
When you have default document (like index.html) in a folder, the server servs the default document instead of directory browsing. So if you want to let directory browsing when you have index.html, you have to clear the index.hmtl from the list of default documents. This can be done using IIS settings (if you have access to server) or through hosting control panel in website settings (in shared hostings) (or by direct editing of web.config or .htaccess)
the navigator displays an auto generated page
No. This has nothing to do with the browser. The browser displays whatever the server returns. Nothing more, nothing less.
What you're seeing on that link is from the Apache web server. That web server is configured to (and can be configured not to) return a generated directory listing when no default response can be determined.
The "default response" might be index.html, or default.html, or literally anything that the web server is configured to look for by default. (Those are just, well, the common defaults.)
In many modern web applications the concept of a "page" doesn't even really mean the same thing, because things like MVC frameworks don't just browse directories for .html files but instead examine requested routes and generate responses from code.
Is it possible to access such a page on a website, eventho index.html exist in the folder ?
No. Because that "page" doesn't exist. The web server returned that to you because it was configured to. If it's not configured to then that data doesn't exist.

Website auto-detect SHTML pages

We just received a code for a website. Nearly all of the links are broken because they didn't add .shtml as a file extension to any of the links.
Is this due to them simply forgetting or is there some configuration where we would basically tell the website to automatically detect ".shtml" pages?
Thanks!
There are numerous ways for a server to map a URL onto a file based on a word in the URL with the addition of an extension (either a hard coded one or one provided in a list).
The obvious ones that spring to mind for Apache HTTP (your milage will vary with your web server) are multiviews and mod_rewrite.

How to create HTML5 100% offline applications?

Sometimes I need to write a small program just to represent some data in a chart, or similar stuff. I have been wanting to do this kind of things through the browser, with HTML5. I think it would be nice to use its canvas to create a nice UI for simple apps.
I have read some articles related to offline applications with HTML5, but they focus on downloading all the data you need and save it to the cache to use it offline later. You even need to set up an Apache server (or similar) to create your app.
I don't need my app to be online, just in my computer. I just want to create a simple application, nothing to do with internet at all.
How can I do this? Is it even possible or worthy? Is there any "Hello world!" tutorial about this around there?
Something like Mozilla Prism would be good for displaying the content as an application.
There's no need to have a web server like Apache for just displaying HTML5/Javascript in a browser. You can just have it all in a folder on your desktop and then load it in the browser with the file:// protocol.
For example file://C:/Documents and Settings/YourUser/Desktop/YourApp/index.html would open an HTML file in a folder called YourApp on your user's desktop.
If you ever find you need to read static HTML+Javascript files locally then I'd recommend using this python command in the console:
python -m SimpleHTTPServer
It launches a simple HTTP server (who'd of guessed) that serves files from the current working directory. Effectively, it's the same as launching an apache webserver, putting some static assets in /var/www/... etc. etc.
You could also just browse to the assets at file:///some/folder; however, most browsers will prevent javascript from using AJAX when files are loaded in that way, which will manifest as a bunch of bugs when you go to load it.