Showing posts with label File management. Show all posts
Showing posts with label File management. Show all posts

Monday, April 16, 2012

Putting files into Blogger's root directory

This article explains the issues, and options, for putting a file into the "root directory" of your Blogger blog.


Turnips (Brassica rapa) 
from Wikimedia commons
Originally posted to Flickr 
by thebittenword.com.  
Licensed under the terms of 
the cc-by-2.0.
If you are using certain non-Google products to enhance your Blog, they will sometimes tell you to put a file into your root-directory.   They may even tell you to use an FTP  tool to do this.

Sometimes this happens when a product also gives you code to install into your blog , This approach is used when the code is written for websites in general rather than specifically to work with Blogger: putting useful files into a place relative to the root directory makes it a lot easier to move a website from a test-address to the live one, so is a common approach outside of Blogger.
Or maybe the other tool has been designed to verify that you do own the website in this way, rather than asking you to change the website code itself.


How to add a file to your blog's root directory:

The short answer for Blogger users is "sorry, you cannot do this".

 The long answer is still no:  "there is no way to do this, but see the rest of this article for an explanation of why, and some suggested work-arounds."


Why not?  Every other website tool lets me do this.

Home - cpg1.5.x demo 1287551599033
Posts:  Blogger's tool for managing
the content on our blogs
If you're clever, and have lots of time, you can make a website just using a text-editor like notpad, a graphics programme, and ftp software that lets you put the files into the right places on computer that's connected to the internet.

Tools like Dreamweaver take away a lot of the time-consuming work, and some of the need for cleverness.  But you still need to know a lot about the internet to do things in a way that makes a good website.

Content management systems make this easier still: they let a technically-minded person do the nuts-and-bolts work to make the website, and give authors / artists / editors / content-creators simpler-to-use tools that let them put "stuff" (ie content) into the website, without needing to worry about the details of how it works.

Blogger is a (very simple) website content-management system, it creates our web-pages for us based on data that we put into certain places. Administrators can set up and change templates, other people, eg authors simply make posts.

When we use Blogger, the main way that we change the data in our web-pages is using the Blogger software. 

Some items inside posts or gadgets can be changed using other software, eg Google Docs, provided they were were set up using that other software in the first place. But - key point - there is nothing in the way that Blogger is put together that means we need to access the base directory. So they don't let us do so.    And I doubt that this this will change anytime soon.


What to do instead

The options for getting around this restriction depend on how the file that you need to put into your root directory is intended to be used.

Installing code:

If you have code to install into your blog, and a file to go with it, then you just need to
  1. Host the file somewhere else (maybe in your Picasa-web-album for the blog, if it's a picture)
  2. Change the code to point to the full path of where you have hosted the file, instead of the relative path used in the code
For example, here is the code for a button linking to my blog, with the picture in the root directory:
<div class="separator" style="clear: both; text-align: center;"> <a href="http://www.Blogger-hints-and-tips.blogspot.com" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"> <img border="0" src="//Logo.png" width="100" /></a></div>
To change this to use a specific location, I just add a file-path and the file-name of the picture wherever it is hosted.
<div class="separator" style="clear: both; text-align: center;"> <a href="http://www.Blogger-hints-and-tips.blogspot.com" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"> <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyPOL71fCHsVZ-J7Kg3ZnaqICz1-ePIMEA4MmSXE9QJ_WZ3XR7t6foQ0bmwLvtLmMY4a5ND7G0VRhS5MenevYd5-FoDHBw1wRuGKR6-h4vIPgJrMU1uQiMlQiSNRMZIg8BtPNnsv96UUE2/s320/Logo.png" width="100" /></a></div>

TIP: blogger's editor sometimes gets links mixed up, so it's important to start the filepath with "http://"


Verifying ownership:

If someone wants to use a file's position to check that you control a website, then they will have code on their own website that looks for the file in your root directory.

You cannot change this code. And you cannot place the fie.

So you need to ask them for an alternative way to verify, that is suitable for people without root directory access.

 If they don't have any alternatives, try lobbying for this on their product support forum:  by not having alterantives, they are ensuring that Blogger users, among others, cannot use their service.

If the official answer is still "no", then you could also ask in other on-line forums if anyone has found any other work-arounds.


What other reasons have you found for installing files to your root directory?   
What work-arounds have worked for you?




An afterthought:   what isn't recommended

Transclusion-iconI've recently seen someone suggest in a help forum that people with custom domains can put files into their blog's root directory by FTP'ing the files into place.

 This may be true, if the service that you are purchasing from your domain registrar includes file-hosting. But file hosting(*)
  1. Isn't necessary for a custom domain used in Blogger (since Google hosts our files for us), and
  2. Isn't available as part of the services when you buy a custom-domain through Blogger.

So it's not a general solution for most Blogger users, though it may work for some.

Initially I was a little sceptical of the idea: Blogger doesn't expect to see any files in our root directory, so I was concerned that it might do strange things if it found them there. But on reflection, I think there is probably a low risk of this happening, since the file-location is outside Blogger's control.

(*) To avoid any confusion, file hosting and DNS hosting are not the same thing. If you buy a custom domain for your blog from a registrar without going through Google/Blogger, then you do need to pay for DNS hosting, but do not need to buy file-hosting.



Related Articles:



File hosts - places to store files used in your blog.

Picasa-web-albums: a quick introduction

How Blogger data is organised

Setting up a new administrator for your blog

Options for letting other people write in your blog
Read more > Putting files into Blogger's root directory

Wednesday, July 7, 2010

Comparing Two Text Files - using Excel

This article is about comparing two text files, making a list of the differences between them and categorising each difference according to whether you care about it or not.   An Excel file tool (available for download) is used, because this helps with making the final list.

The tool was made to support comparing two Blogger templates,as part of Seven Simple Steps to a Snazzy New-look Blog.  But it can be used for many different types of file-comparisons where you need to think about the between the files, keep track of individual differences, and plan actions based on them.




In theory, you can compare two text-files line by line manually. But in practice, especially when the files are made from code like HTML and not English-language sentences, this is very hard to do:  even a one-character difference may be significant, but hard to see.

There are many existing tools that will compare two files.   But a spreadsheet works just as well - and it has other features that can be used to help with making a plans based on the differences found, and tracking progress with fixing them.

I've put some notes about where to put the comparison text files, and how to use the formulas into the spreadsheet, and some detailed pictures below.  But the main point is that when you find a difference you need to:
  • Work out where the difference ends, 
  • Insert some blank cells in the other column so that the code lines up again,
  • Re-copy the comparison formulas into column F (because the insert will have mis-aligned the existing ones),
  • Make notes about differences as they are found - this list is important for deciding what to do next.

    Preparing to compare text files


    Get the two template files that you want to compare, and open them with a text editor (eg Notepad).

    They will look ugly and hard to work this - this is ok, the next step puts them in a better format.

    A text file, viewed in Excel and looking ugly



    Download the Excel tool for comparing text-files.

    Paste the contents of the template file from your real blog in the left-hand column.

    Paste the contents of the template from your test-blog in the middle column.


    Paste the contents of the comparison formula cell (ie the red-shaded one) into every row where there are contents from either of source files.





    NB  the comparison forumla is    =IF(D8=A8, "", "Not the same")

    In the spreadsheet the cell is shaded red, and you cannot see it unless you look in the formula bar  (this makes the pictures easier to read). 


    Doing the Comparison


    In Column F, look for the first row when "Not the same" is displayed.

    Look at the code for that line, and work out what caused the difference, and whether it's is due to a customisation that you made and want to keep, or someone that you don't want to keep, or something else that Google have done in the meantime.

    If the difference is due to a customisation that you want to keep, then make notes about this into the Comments and ToDo columns.





    In the example shown, the first difference line is a meta-tag, which I do want to keep, but the second is just the tag-close command:  I don't need to put it separately into my plan, so it's marked "no".

    Re-match the lines of code
    If the difference was due to extra code, then
    • insert some extra rows in the other column so that the matching code lines up again, AND
    • re-copy the comparison forumula into the rows from there down.



    Repeat these steps until all the differences are understood.

    At the end, copy the comments and notes columns into another worksheet, and use Excel's sort functions to extract a list of the differences that you need to deal with.

    (I like to use Excel to keep lists of planned changes too - but that's a whole different topic.)



    Related Articles


    Making a test-blog for testing template changes

    Seven simple steps to a snazzy new-look blog.

    Showing a PowerPoint presentation as a slideshow in your website

    Planning changes to your blog - in private
    Read more > Comparing Two Text Files - using Excel
     
     
    Copyright © blog
    Blogger Theme by Blogger Designed and Optimized by Tipseo