Logo Link & others

Oct 29, 2010 at 12:40 AM

Hi

Firstly many thanks to the community here for all the hard work on Graffiti. I've been playing around with it for a few days and I'm stumped with a couple of things which I hope I can get some help with.

1) I've created my own theme based on the default and my logo links to graffiticms.codeplex.com. Where/how do I change this?

2) A really daft question I'm sure but the website I'm working on needs a home page which is basically a splash page. Should I be creating a post for this and if so what do I name it and how do I exclude it from being published as another post?

I'm sure there will be lots more questions from me as I think I like Graffiti -)

Coordinator
Oct 30, 2010 at 4:00 AM

1) In your theme, probably in layout.view, you should see that URL. Change it to $urls.Home to have the logo link to your site's home page or a static URL if you want it to go somewhere else.

2) To have a specific page displayed in place of the default home page layout, here's what I do:

  1. Create a file in your theme called "home.view"
  2. Put the following code in that file:
           #set($post = $data.GetPost("homepage"))
           <div class="post">
               <div class="entry">
                $post.Body
               </div>
           </div>
    
  3. Create a post named "homepage" (or whatever you put in the "GetPost" call above)
    1. Make sure you make the post "Uncategorized" or in a category that you don't display on the site.

The HTML you use in the view is dependent on your theme and CSS; the important part here is the first line, which creates a post variable for you to use, and then displaying the post body with $post.Body somewhere on your page.

This will not prevent the post from being published, so you can go to "yoursite.com/homepage" and see the post, but if you don't link to that URL, it really shouldn't matter.

Oct 31, 2010 at 2:59 PM

Thanks Charles for your reply but I still can't get the logo to link to my site's home page. I do have $urls.Home in layout.view and it does link correctly if I just use $data.Site.Title but this just displays text linking to the homepage and if I display the logo via CSS the logo of course is not linked and the link text just sits on top of the image.

What I had done was change the graffiti logo image to my my site’s logo image and used $macros.Logo which displays my logo nicely but of course links to graffiticms.codeplex. Inspecting the element shows id=graffiti_logo. So my question is how do I change this ID or have I done this completely wrong?

Coordinator
Nov 1, 2010 at 3:03 AM

Yeah, $macros.Logo is apparently a completely useless function - here's the code for it:

return "<a title=\"Powered by Graffiti CMS\" href=\"http://graffiticms.codeplex.com\">" + LogoImage + "</a>";

It is basically hard-coded to display the link to Graffiti CMS.

That function REALLY needs to be changed, so I'll look into it over the next couple of days. If you need to get around that, you can just put in your own HTML to render the logo as a link:

<a href="$urls.Home">$macros.LogoImage</a>

Also, you actually CAN do what you said about displaying the logo with CSS if you use it as a background image for your link, set the link's height and width to match the image size and then give the link a negative text-margin to hide the text (and only show the logo. I did this on my site (although I'm probably going to change it back), so you can see it working: http://www.nexustechnologiesllc.com/.

 

Nov 4, 2010 at 3:28 PM

Yipee it now works, thanks again Charles.

I had <div class="logo"><a href="$urls.Home" title="$data.Site.Title">$macros.Logo</a></div> when I changed $macros.Logo to $macros.LogoImage it linked correctly.