Forgive me, for I am relatively new to Angular 4, but I am stuck on something...
I would like when a user goes to https://example.com/sitemap in their web browser...
<head>
, <body>
, <script>
and
other contents of my src/index.html, should not be included in
the response).I have done plenty of Googling and searching Stack Overflow -- but everything I find is just about ingesting an XML document, or writing XML to a page, but not writing an XML document back to the web browser.
Working examples would be appreciated, as I am still learning all the in's and out's of Angular 4.
View an XML file in a browser In Chrome, just open a new tab and drag the XML file over. Alternatively, right click on the XML file and hover over "Open with" then click "Chrome".
After creating the project, open the project in your favorite editor and install the "timers" npm package. This package is necessary for reading an XML file with xml2js package. Open the index. html present at root folder and add a reference for Bootstrap and jQuery.
Click File > Save As, and select the location where you want to save the file. , point to the arrow next to Save As, and then click Other Formats. In the File name box, type a name for the XML data file. In the Save as type list, click XML Data, and click Save.
As nobody could seem to offer an answer, I created my rather own hacky answer. As I am using Firebase for hosting, I leveraged Firebase Storage API to save off my sitemap.xml file and then forward the browser to the just generated document.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With