Lessons: 14Length: 1.6 hours

Next lesson playing in 5 seconds

  • Overview
  • Transcript

3.4 Adding a Default Author

Self-promotion is an important part of writing a blog! If you are spending a lot of time writing posts, you probably want visitors to know who wrote them. So now it's time to give yourself a little credit by adding some default author information to your site.

3.4 Adding a Default Author

As mentioned before, when it comes to these posts, it's often nice to attribute them to whoever wrote them. And if you're building your own site or your own blog, then traditionally, you're gonna be the only author. Now obviously, you can have guest authors and all sorts of things like that. But let's start with the basic use case of this is your site, your blog. And you want to display some information about you or in this case since I'm building this then I'm going to build it about me. So how do I add in this author information to my site? Well, once again you head over to the documentation and let's go into the customization configuration section and on the right-hand side you're gonna see on this page. If I scroll down just a little bit, you're gonna see a section here called Site Author. So if we click on that, you're gonna see some information about what the default information is, or how to display information about the author. And as you can see it shows up on the left-hand side over here next to your posts. And you'll see an image, a description and some links to your website, your Facebook, social media, all that sorts of good stuff. So let's go ahead and add that into our site now. So if we come down a little bit further, you're gonna see that you can add in some front matter defaults basically for your site to be able to specify the author of all the posts. So what I'm gonna do is I'm gonna grab all of this information here. We'll grab some of it, we'll use some of it, we'll get rid of some other ones that we want. So let's go ahead and take this, and we're gonna go into our config file. And we'll just drop this in somewhere that makes sense. Maybe I'll put it up a little bit higher cuz it's maybe something more common that I might want to add to or make changes to. All right, so the author, so you just fill out some of this information. You can fill out your name, so I'm gonna say Derek Jensen. Avatar, which is usually something good to have on there to have some sort of bio photo. So what I'm gonna do is I'm actually going to add in a picture of me, I'm sure everybody wants that. So what I'm gonna do is show you how you can typically include images on your site, not just necessarily for this, but for any part of your website. Whether it's for the headers or any images you wanna display in your posts or on your pages, then typically what you'll do is you'll simply create a new folder called Assets, and then within Assets you will create a new folder called Images, and then you can just put all of your images directly in there. So what I'm actually going to do is I am going to move some things out of the way a little bit. And down here I have an image of myself, I'm gonna drag that and I'm gonna drag it into Images, just like that. So there's me, hello everybody. And what I'm gonna do is I'm going to use that image now. So as you can see here, I want my avatar to be the file that's represented by assets, images, and I believe I just named it me.jpg, all right? Just like that. Bio, so you can put some information about yourself. I'll just say a lifetime mid westerner that loves teaching people about technology. Something like that. Okay? Then you can put in your email. Once again, that's optional. I won't put it in here for now. It's not necessary. URI. So you can put in your site. So if you want to link out to another site somewhere, you can do that. Home, you can put some information or relative URL to the author home, that's fine. I don't really wanna do that. But you can start to add in social media as well. So I'm gonna add in Twitter. And so for most of these social media links all you have to do is add in your user name typically. So mine is going to be Creative D. Like that. And we'll go ahead and save this. So, now I've created a default author for my site. Because it is in the config section of my site. I have my name, I have an image of myself for my avatar, a bio, and my Twitter handle. And that's really all you have to do. You just define this in here. So, what I'm gonna do is I'm going to make sure I save all of these changes and I'll say add default author. And then let's go ahead and push that up to GitHub like we've done with just about everything else. And the nice thing about this is that because I have already added in some defaults from my posts, to the point where I want to have the default where is shows the author profile to be true, I really don't have to make any other configuration changes. All I have to worry about is that I fill out some author information for my site. So hopefully it only takes a few moments to actually update my site. And, if everything works correctly, when I refresh my page you should now see my author information over to the left of all the posts by default. So, you'll see your picture, your name, this is your bio, and then a link to your Twitter. And so you can click on this and go to your Twitter account. So, this is really nice because now, I can go to any post in my blog and I'm going to start to see all of my author information. So once again, just as a reminder, this is really beneficial if you are the only author on your site, on your blog, and you wanna display this so people can see who are, maybe get in contact with you, follow you on social media, and all those sorts of things, which is really nice. But also just like you were doing with the Front Matter defaults, let's say for some reason your blog starts to get really big and popular and you start having guest posts and guest authors and things like that. Well, that's absolutely fine. You have this author section here at the config level at the root, kinda global level, that's gonna put you as the author for everything. But you can just as easily override it, just like the defaults, by adding in an author section to the individual post with things like assert images for the avatar and other descriptions about the author for that particular post, and it will overwrite those defaults just like it did for all the other settings that we were doing for the individual posts, which is really nice. So, now, we're getting to the point where our site's looking pretty polished. We can do a lot of really cool things. We can create custom pages, with custom content, using just mark down. I can create blog posts that get ordered by the publish date, I can share them, I can add all sorts of cool configurations. And this is just really the tip of the iceberg. There's so many other things that you can do. And so in the next lesson, I wanna walk you through some of the really nice features, not only of Jekyll, but also of this theme that you can start to take advantage of as you start to grow and get bigger, creating your custom website using Jekyll and GitHub pages.

Back to the top