This project is read-only.

Javascript code appears in Recent Blog Posts content item

Topics: Troubleshooting
Jul 23, 2013 at 4:33 AM
In the Recent Blog Posts content item, some Javascript code for my Google Map appears before the "more" link in the "Location" post. However, this text does not appear in the full post. How can I remove the code from the Recent Blog Posts item?
Jul 25, 2013 at 8:25 PM
Edited Jul 25, 2013 at 8:25 PM
Just checking in to see if anyone has any idea how to fix the problem I described in my post.
Jul 25, 2013 at 8:27 PM
Where does that Google Map code code from? Did you include that in the body of that post?
Jul 25, 2013 at 8:51 PM
Yes, all the code is in the body of the blog post. See the code below.
The Solar Decathlon China competition is located in <a href="" target="_blank" title="Wikipedia page">Datong</a>, a <a href="" target="_blank" title="Wikipedia page">prefecture-level city</a> in the northern Shanxi province of the People&#39;s Republic of China.

<script src="[KEY REMOVED FOR SECURITY]&sensor=false"></script><script>
      function initialize() {
        var mapOptions = {
          center: new google.maps.LatLng(40.091402, 113.359591),
          zoom: 11,
          mapTypeId: google.maps.MapTypeId.HYBRID
        var map = new google.maps.Map(document.getElementById("map-canvas"),
      google.maps.event.addDomListener(window, 'load', initialize);

<div id="map-canvas" style="height: 500px">&nbsp;</div>
Jul 25, 2013 at 9:04 PM
Putting script in body is not good practice, but if you must, you can alter the way the summary is rendered:
Jul 25, 2013 at 9:12 PM
Thank you very much, Bertrand. I'm including script in the body as a stopgap measure until I better understand and have the time to implement best practices. What is the best practice for this kind of script? Should it go inside my theme's Scripts folder?
Jul 26, 2013 at 12:00 AM
It depends what you are trying to do.
Jul 26, 2013 at 5:07 AM
Edited Jul 26, 2013 at 5:07 AM
In the near term, I'm going to be creating a lot of blog posts that will include one-off content using various Javascript and jQuery APIs, such as Google Maps, amCharts, FullCalendar, HotspotMap, etc. What is the recommended approach for including such one-off content in Orchard blogs, assuming that I'm not currently too worried about code duplication or other best practices?
Jul 27, 2013 at 6:08 AM
If it's one-off (which is weird), then yes, put it in the body.