The Intro:
You’re right. What HTML Snippets do is the following: An html snippet creates a new page in which the code you enter in the snippet is added to, this new page is embedded in the page you added the snippet to with an iFrame. Result: the code isn't even where it's meant to be.
For most people that will be satisfying/sufficient/good enough but in some cases it isn’t for me.
When I have an HTML Snippet on a page and I add the Statcounter code to all my pages using iTweak or iComment the code is added to every single snippet too. Thus a visit on that page with the HTML Snippet in it gets counted twice: first the page and second the snippet. Which is pretty annoying to me.
That’s why I now present you an alternative way to embed HTML in your iWeb created website.
The Solutions:
Solution 1: Manually editing HTML (not recommended)
Solution 2: Using MassReplaceIt
Solution 3: Using iTweak
Solution 1 - One solution would be editing the html code manually post-publishing.
To do that you have to open the published pages (.html) in a full-text- or an html-editor.
Search for where you want the code to be added to.
Paste the code when you did find the right spot.
Problem: Every time you publish you have to do it all over again. If you have a lot of codes and a lot of pages (and I do!) that’s pretty time consuming, thus that solution doesn’t work for me.
Solution 2 - The second solution is much better and works the same as the third solution:
1. Go here and Download MassReplaceIt (it’s free)
2. Open iWeb
3. In the page or in the pages you want to add the HTML code to, create a Text Box of the size of the result of the HTML code you want to add (if the code is a video or an iFrame you have to create a Text Box with the size of the video or the size of the page you want to display in the iframe unless you want to enable scrollbars)
4. In these Text Boxes enter a code or a word you’re sure it doesn’t appear anywhere else on your pages (I use BlueBlackWhiteNight1; BlueBlackWhiteNight2; BlueBlackWhiteNight3; ... one for each different html code, thus same html code=same code, because I’m sure that those appear only in the Text Boxes where I want to have the HTML code). Put this code Text Indent 2 px (Open the Inspector, go to the Text tab and choose List change the text indent to 2 px)
5. Publish your website to folder or iDisk
6. Open MassReplaceIt
7. In Find you enter BlueBlackWhiteNight1 or whatever
8. In Replace you enter the html code that has to go in the Text Box
9. You can set more than one Find&Replace at once if you want to add more than one
10. Save the Query and make it the default
11. In Files add the folder you publish to from iWeb or the iDisk folder (iDisk/Web/Sites folder)
12. Click “Replace” and the HTML code will be added
13. Re-run MassReplaceIt every time you (re-)publish
Important note about MassReplaceIt settings:
- In Options select Search=Contents, Location=Entire file/Filename, Options=Search whole words
-
-In Preferences When adding a folder toa search list=Add a folder, Search folder’s name and contents
-
-In MassReplaceIt go to Mask click on "Add" "Search items whose:" select "Extension" From the other drop down menu select "is" and then type ".html" (without "") and click on "Add..." and select "All criteria, must be satisfied to search a file". Doing this speeds-up the process of searching.
To fix it on a page copy and paste the textbox in the main textbox of your page. Now if you add text the “Snippet” will move automatically with the page.
Solution 3 - The third solution works pretty much like the second one. But instead of using MassReplaceIt it uses iTweak.
1. Go to the iTweak page and download iTweak (it’s free)
2. Open iWeb
3. In the page or in the pages you want to add the HTML code to, create a Text Box of the size of the result of the HTML code you want to add (if the code is a video or an iFrame you have to create a Text Box with the size of the video or the size of the page you want to display in the iframe unless you want to enable scrollbars)
4. In these Text Boxes enter a code or a word you’re sure it doesn’t appear anywhere else on your pages (I use BlueBlackWhiteNight1; BlueBlackWhiteNight2; BlueBlackWhiteNight3; ... one for each different html code, thus same html code=same code, because I’m sure that those appear only in the Text Boxes where I want to have the HTML code). Put this code Text Indent 2 px (Open the Inspector, go to the Text tab and choose List change the text indent to 2 px)
5. Publish your website to folder or iDisk
6. Open iTweak
7. In Find you enter BlueBlackWhiteNight1 or whatever
8. In Replace you enter the html code that has to go in the Text Box
9. You can set more than one Find&Replace at once if you want to add more than one
10. Save the Search&Replace, next time you open the saved search&replace and don’t have to retype all the stuff in each time
11. Click on “Choose Published Site”
- If you publish to a folder choose the folder you publish to from iWeb
- If you publish to .Mac select your iDisk/Web/Sites/ folder where iWeb publishes to.
If you can’t choose the iDisk because you don’t see it go to Finder/Preferences/Sidebar and check the box near the iDisk
12. Hit “Process Site” and you’re done.
Note: You have to run iTweak every time you re-publish from iWeb.
What is iTweak? and what is it good for? Have a look at this page
For further information and download on guimkie.com
We would like you to give us feedback on this page by commenting here. Tell us if it was helpful. If it wasn’t tell us why. If you think something is missing tell us what.
If you have a question please make sure it is relevant to the content of the page. Look through our FAQs and look where it fits best. If you can't find any FAQ on the topic post on the main page of our FAQs. Please do not post your question to the main page if there's a relevant FAQ. However we recommend you to post questions to the AppleDiscussionForum for iWeb.
Thank you.





