image: thumbnail.jpg
Meetup | Deepsha Menghani, Microsoft | Create Your Data Science Portfolio with Quarto
⬢ Link to slides: https://deepshamenghani.quarto.pub/portfolio-with-quarto-workshop/#/title-slide
Abstract:
A data science portfolio is a collection of your work that can be used to demonstrate your skills.
While many data scientists understand the need to create a portfolio website, the task of putting your projects together into a clean website format can be difficult and high maintenance.
In this meetup, learn how you can easily create a Data Science Portfolio website and deploy it instantly with the help of Quarto. See how you can also easily maintain and update it whenever there are new projects that you want to showcase in your portfolio.
Speaker bio:
Deepsha Menghani is a Sr. Data Scientist at Microsoft. Her work focuses on investment impact analysis and propensity modeling. When she is not geeking out over data, she is knitting or collecting yarn.
For more info on Quarto: https://quarto.org/
To ask questions during the meetup, please use: pos.it/meetup-questions
*the recording will be available immediately following the presentation at the same YouTube link
Transcript#
This transcript was generated automatically and may contain errors.
So in the data science hangouts and meetups, we repeatedly hear about the importance of showcasing your work from data science leaders across every industry. So whether you're thinking about building your personal brand to break into data science, transition to a new role, or maximize the impact of the work within your current position, you need to make it easy for others to explore your data projects. However, putting projects together in a clean format and maintaining them can be difficult.
So this is something I'm really excited to explore Quarto for in our fourth Quarto meetup of the series. You can view the recordings of past sessions at the link, which I'll share in the chat in just a minute here. But those other Quarto meetups are welcome to Quarto workshop, building a blog with Quarto and building reports and presentations.
Today, you'll learn how to create a data science portfolio website and instantly deploy it using Quarto. You'll also learn how to easily maintain and update this portfolio whenever you need to showcase new projects.
As always, with meetups, there will be a few ways to ask questions today. You can ask right from the YouTube chat or you can use the Slido link, which I will pull up on the screen here, and I'll put it into the chat so you can copy and paste it. But you're able to ask questions anonymously there as well.
I am very grateful and excited to have Deepsha Mangani joining us for today's event. Deepsha is a senior data scientist at Microsoft focusing on investment impact analysis and propensity modeling. When she is not geeking out over data, she is knitting or collecting yarn. So I'd love to pull you up on stage with me here, Deepsha, and turn it over to you.
Thank you so much. Awesome. Thanks, Rachel. Hi, everyone. My name is Deepsha. And today I'm very excited to talk about how to create your data science portfolio with Quarto, which is something that I have done myself. So we'll hope it's a hopeful session for everybody.
What is a data science portfolio?
But before we talk about the jump into the Quarto portion of it, let's give a brief minute to what is a data science portfolio to ground everybody. So usually we use a data science portfolio to showcase some of our best works and showcase our skills as a data scientist. The components of a data science portfolio are usually a brief about me section, some of your favorite projects, your resume and ways to connect with you in case somebody looks at your website and likes what they see.
A good portfolio website usually is catchy. So what people are reading, they want to continue reading more about it. It should be simple and concise and easy to navigate. People visiting your data science portfolio website should be able to find what they're looking for. And the last thing, it should be up to date. So which means that if, let's say, you did a brand new project or change your employment, had something, anything change, you should easily be able to update it and have the most latest information on your website.
Having said that, we all know what a data science portfolio is, how important it is. But just at the thought of creating one, it can be a little bit intimidating and daunting. And that's what my initial thought was until I saw Quarto and how easy it made it look, just creating your website.
Example portfolio website
And so before we go into that, I just want to showcase an example portfolio website that I created just so everybody, again, grounds as to what it looks like. So this is my website. On the front page, there is my photo, a brief description about myself, all the ways to connect with me. And if you click the links, you'll find my projects.
Note that these are all external projects. So somebody clicks on this. These are projects that I already had before I sat down to create my website. So this is a medium blog that I had written on data science stakeholders. Then I also have a blog set up within my website. So this is a Tidy Tuesday is a weekly data visualization event that's run by the Posit community. So this is my submissions for that. So if you click on this, you see that the code is all within the website. And anybody who wants to draw that thought is able to see the code and do that.
Then I have two types. I have uploaded a resume. One is uploading an existing PDF resume in as part of your website, which almost all of us have. And then just to show an example that you can also create your resume within the Quarto website. I created a resume for Wednesday Adams because she's my absolute favorite character. And gave talked about her AI experience, which I think she is absolutely amazing at. The advantage of doing that is that you can also add charts made with. This is made with Gigi Plot and Gigi Trends as a part of your resume. So you can be creative about that.
Why Quarto for your portfolio?
So now that we have an example of a portfolio website, let me jump back into why I chose Quarto to build this. So first of all, Quarto is an open source scientific and technical publishing system built on Panda. So we will see how it is used to publish anything. But the advantage of using it is you can be tool and language agnostic because Quarto supports multiple languages. And tools or ideas that you are familiar with.
The base blog website skeleton that Quarto provides when you try to create that project is just by default. So clean looking that I had to do very little work to make my website look the way I wanted it to look. And it was very quick and easy to update. Now, even if you have a very basic understanding going into this of any of your Quarto supported languages and ideas. You should be able to build it.
So clean looking that I had to do very little work to make my website look the way I wanted it to look. And it was very quick and easy to update.
I'm going to be using RStudio and R today, but you can use other ideas and languages that you are comfortable with. So Quarto comes installed with RStudio, but for other platforms, you can install it very easy. If you want to learn how to do that, I've linked in the footnote here. You can go to the site and check out those options.
Perfect. So what we will cover today is configuring your website. So you saw the tabs that I had going, adding content to those tabs, customizing your website's look to your unique self and publishing and updating your website as you need.
Creating a new Quarto blog project
All right. So let's build a portfolio. So first I'm going to. There's a video here on how to create a new blog post. I'm going to actually blog project. I'm going to just show this to you here itself. So when you click on project and new project, you just go to a new directory. What you want to create here is a Quarto blog. And when you create a Quarto blog, you give it a name and you create your project. Something like this pops up. Let me do that.
Portfolio example. So while it's opening up, let me show you what the Quarto project would look like. It would open up with some of these files by default, like right out of the bat. It would have a few files. So let's see those files again. So these files are just right off the bat there. You don't have to create these files from scratch. So the few files that you see here are Quarto YAML file and indexed Quarto Markdown and about Quarto Markdown. We're going to deep dive and look into every single one of this.
But the way you render your project is you just click on render your website. And just initially the website that it looks like, it's very, very clean. And I'm going to come to what that looks like. All right. So from here onward, I'm going to switch between our studio and my presentation. So I want everyone to gather around and just pray to the lifeguard gods that everything goes smoothly. But I have everything in the presentation for you to go back and look at.
All right. So when I render it, this is what it looks like. Just the initial website. I had to do nothing to start with. I'm going to expand that a little bit. But you see here, I've got a project, some of my projects. I've got a about page. So if you click on that about page, you have an about section with a photograph, description, links for contacting you. And Twitter and GitHub links to take you to those pages. Obviously, right now, it just takes it to GitHub.com because we haven't edited anything. So it's not personalized to me. But right off the bat, you see here, you've got a beautiful, elegant looking homepage, etc.
Understanding the project file structure
So now we're going to jump into how to edit this stuff. All right. Before we do that, how to edit my website to look the way I want it to. I'm going to briefly try to describe the structure of our blog project and deep dive into each file. So the first important file that we're going to look at is the Quarto YAML file. So the Quarto YAML file you see here has the YAML components that describe what my project is. So it's a website type of project. The title of my website that you see here is Portfolio. It has a navigation bar. And on the navigation bar, it says that on the right side, put this about section, which if somebody clicks, whatever content exists in the about.qmd should open up. Then I have the GitHub icon that references to GitHub.com if somebody clicks on it. So that's what the icon and href mean. Similarly, there's a Twitter reference as well. The other thing that you have in the YAML that's important to note is your format component, which says what should be the theme of my website. So by default, it picks up a Cosmo theme. I'll show you some more themes you can use. But by default, it picks up that theme, which has a certain color schema, font sizes, font types, etc.
Perfect. That's the YAML. So what YAML did was give us the structure of the website. The next important file to note is your index.qmd, which is our index.quarto markdown, which always defines what your homepage is going to look like. So what your homepage is means that when somebody clicks on your website, the page that opens up is defined by your index.qmd. So that's what here it looks like. So in this case, in our very initial case, all it says is, hey, index.qmd title is portfolio. I have a listing component which says this page should look like a listing of content and pick up my content from this other folder called posts. So there are some default posts inside that folder, which we will go over. But that's what this YAML component says.
So every QMD file initially in this blog project has this YAML component. And then the markdown component starts from under the YAML component. So we will see how to edit both of those and what they do. The next file is the about.qmd. So if you remember, our quarto.yaml file said that if somebody clicks on this, open up whatever is in the about.qmd. So what's in the about.qmd is a template that says it should look like an about page, which is this. It should look like an about page with a template of Jola. And we will show other templates as well and add those links in that template to reach out to me.
So I showed you three files. But just to recap it very quickly, because I think this is the most important thing to note when you're trying to configure the website to make it look like the way you want is you have the index.qmd, which is your home page. You have the quarto.yaml file, which tells you what is where. So where your navigation, what's inside your navigation bar and what the format of the entire website should be like. You have an about.qmd, which is whatever opens up when you click on about here, which doesn't have to be called about, but in this case it's called about. So whatever opens up and you click that, you have CSS files that you can use to format your file further, format your website further. And you have a post folder, which has all the contents of whatever you want.
Index.qmd calls to say that, hey, pick up the post from this particular folder. It can be called something else. It can be called, hey, go pick up my content from the visualizations folder. But in this case, it just says, OK, pick it up from the post folder.
Editing the quarto.yaml file
So now that that structure is defined, let's go and start editing the structure. The first thing we're going to do is we're going to play with the quarto.yaml file. I'm going to close this file right here and we're going to work with this file that I have some images in. All right. So quarto.yaml, if you remember, I said it defines the structure of the navigation bar. So in the navigation bar, let's add the first thing we're going to do is add tabs. Oops. So let's add a home tab. So text home and let's make it. All right. Picking up by default. And that's a good thing about yaml and Quarto. It's like the auto completion is pretty amazing. So you don't have to remember a lot of things in the yaml. It just is able to read that by default. Now, let's make the homepage points to index.qmd. Let's add another tab called projects. And let's make that.
It is. It loves doing that. Let me just do this. Projects.qmd. And I'm just going to copy paste this and create one last tab for my resume. Note that yaml is very space sensitive. So keep an eye on like how you're adding the spaces here.
Right. But as soon as I save this, you will see the good thing about yaml is you're actually able to see everything add immediately. Perfect. There. So if I move this here, you saw all these tabs got added. When I say text home, it means give this a home text and refer it to the index.qmd. The reason I like to add a home tab is because no matter where you're on the Web site, if you just want to go to the home page, it's always good for giving that option that is clear, descriptive, that if you click on this, you will come to the home page of the Web site.
We already have an index.qmd. So right now, when you click on it, this opens up. But note that we don't yet have a projects.qmd or a resume.qmd. So initially, right now, if you try to click on this, nothing's going to open because those don't exist. And we're going to create those in a minute. All right.
So close that. Going back here. So just like that, we had our tabs. So we have like a basic structure of our Web site ready. Now let's add content to it. So the first thing we're going to try to give this Web site is a elegant home page. So on the home page, I did not want content right off the bat. I wanted my home page to look simple like an about page. And so I used an about template for my index.qmd. So I'm going to copy paste this to show you what that would look like.
Creating an elegant home page
All right. So if you go to your index page, I'm going to just delete everything because I don't want posts on my home page. I want to ease into it and add a bit of like a description way. So if you edit your index file to say, hey, use an about page template called Jola, add an image to it. And I can show you that while it's rendering. OK, so you go into build and when you click on render, that's how you render that Web site. So use the Jola template, take an image, give it this width and make it round and give my about page the name of Deepsha Mingani.
So I use Jola template, but that's not necessarily the template you need to use. So let me show you where you can find pre-existing about templates from Quarto. So if you just click on the link in the footnote, you can see there's other templates like this. If you wanted your about page to look slightly different and there's these other ways you can do it. So note that images in different places, your description is in different places. And also these links that we're going to add later are in different places. So that's how that's how you can pick it up, whatever template you want.
So let's add like if I add a free description, I am Deepsha. I like that. If you just render this, that will show up instead of your about this about this blog page. So I'm going to go back to this. So just like that, you can add your whatever description you want to show up right here. And now let's add these links. So note that based on the template, these links would show up at different places. So I'm going to copy paste this links to show you how that would look.
So where you add the links is still in the section. So if you just add the links here, what it says is, hey, add an icon for Mastodon. So I'm going to render that to show you what that would look like.
So if you remember, I had added an edited my description, so that showed up right here. And what it says is add an icon for Mastodon, which is this M icon, add text beside it called Mastodon and refer it to my Fediverse account. If somebody clicks on it and similarly for the rest of them as well. And so you see all these different icons, Twitter, LinkedIn, GitHub, contact me. They're all bootstrap icons. I have used envelope here. You don't have to use envelope. You can use a mailbox icon. But where do you go find all these icons? I have linked them right at the bottom here. There is a whole bunch of icons. So let's say I wanted like a good mailbox icon. I can just use like this if instead of in the icon, instead of envelope, if I said mailbox to this is the icon that will show up beside it. So you can play with the look of your website there as well. Perfect. So that is our homepage. It's ready.
Adding the resume tab
Now let's update the next next thing, which is our resume tab. So note that we don't have a resume dot QMD. So which means that if somebody clicks on resume tab, nothing's going to open. So I'm going to go into files and create a resume dot QMD. It opens up here. Now, there's two ways, like I talked about earlier, that you can update your resume. One is you, if ever any of us has had to look for a job, we probably have a PDF version of our resume. So the the least resistant thing to do is to just update, upload that resume in our website as it is. If we don't have the time to create it within the website itself.
So let's first look at how you just embed a PDF within the website. So I embedded my PDF as an iframe that if I just add this. Oops. If I just add this component in my resume dot markdown, it would show up like this. So if you see here, it would show up as a PDF in my resume. And based on your website, look, you can figure out what height or width that you want. So in this resume, if you just copy paste this, it says, hey, pick up my resume from this location and it'll just show up like that.
Or you can update your resume within the website itself. So here, if you see that Wednesday Adams resume is right here within the website to just give you an idea of how you can do that. I have linked the GitHub repo for Wednesday Adams resume that I created. You can play with it, edit it, see how you feel creating a resume within the markdown. And once you feel comfortable and ready, you can update your resume to document with that resume and be able to create a resume like this. I find this better because I'm able to like add charts and give it give my resume a more of a unique look as compared to if I just updated my resume as a PDF.
I find this better because I'm able to like add charts and give it give my resume a more of a unique look as compared to if I just updated my resume as a PDF.
Building the projects page
All right. Now we're going to go to, I think, the most important part of our portfolio, which is the reason we have a portfolio, is to showcase the projects. So I'm going to delete this for now so that we're not trying to embed a PDF. But let's say we did not have a project.qmd when we started. But if you remember, we told quarto.yaml that if somebody clicks on projects, open the projects.qmd file. So I'm going to very quickly create a projects.qmd file here.
All right. So I want my projects.qmd file to look like a page of listing to look like a listing of content. And the good thing is Quarto already has some really clean looking templates for uploading your content. So if you just give it content, it would make it look like this or it would make it look like a different way based on the template you use.
So let's try to create this on the fly here. So what I did here is I said, render website. I said, hey, on my projects.qmd, give it a title of title to that page of projects, make it a type of content listing. So content listing and go pick up. So if you click the link here, you see now content has been added. So pick up the content from the post folder. I'll show you the post folder in a second here. Arrange it in descending order. Type default. I'll come to that in a second. But also add categories here to each of my content. I'll show you how to add those.
Sort UI and filter UI is just the ability for your reader to be able to sort the content in a portfolio. I feel like you don't have like it's important that you don't overload it with content. So there is a little bit of content. You don't necessarily need that much of a sort option. So it's OK to keep it false, but you can play with it as well because those are some neat options that are available.
All right. So let's now go look at the post folder. So you have two posts, posts with code and welcome. So if you see here, there's a post with code and welcome to the blog. Let's go inside the post with code and see what all it contains. So inside my post with code, there is an index dot mark QMD that says, hey, this is my post with code. It has some executable code and it shows one plus one. So if I click on my post with code, that's what you see here. I have a title post with code. I have some categories and I have this description with some code.
Let's close that and let's actually try to add a brand new post that we wrote. So I'm just going to use this template and instead say post with plot. So my post with plot has an index dot QMD and an associated image with it. Let's edit that index dot QMD. This is not a post with code. I'm going to say post with plot and I'm going to say written author me. And just to showcase something, I'm going to put the date as a future date for when I created this. I'm going to give it some categories here. I'm going to remove the newest category and I'm going to give it a plot category. And you'll see it up here. I'm going to say, OK, pick up the image. JPG to showcase and where it showcases that image.
Is right here. This is the image where it showcase. This is a post with executable code. I'm going to say no, this is a post with plot and I'm going to just add a plot here. Let's do that. Empty cars. All of our favorite data set.
So if you see a plot got created. Perfect. So I'm going to just once I've done this and actually let me also change my image. Save image as and I'm just going to save that image instead of that previous image that we have. Oops. Sorry about that. Large sound. And then I just render this and see how that appears in our post.
Perfect. So this is what that post looked like that I added. But you will also see that here it got added right here. So I have my post with plot because we had told the projects or QMD file that arranged my posts in a descending order. It took that latest post because it's a future date. It's showing up as the first post. These categories are really cool because if I just want to see all the posts with code, I just click on it and that shows up all the posts with analysis and with plot or I can see all the all the posts. Right here is your image that gets picked up. And if you click on it, you're able to see the post. So that's how easy it is to add a new post.
And if you just delete the other posts that are here, those just won't show up. So my projects are QMD. I said go into the post folder and pick up all the posts from there and present it on this website page.
Exploring listing templates
So if you don't want your post folder to look like that, or if you don't want your projects page to look like this, there are some other templates. Let me just show you quickly what those templates look like. So this is a type default. So if you remember here in the YAML section of my projects on QMD, I gave the type default. But if you wanted to say there they are grid template and this is also a good template. Let's say you exceed the number of projects to more than four or five. I'd recommend using a grid template so that you're not having the person on your website keep on scrolling too much. If your website is a little bit heavy and you want to, let's say, try to increase your speed a little and not have too much images while loading your website. You can also just use a tabular kind of a template.
In fact, you can have your projects as a different tab with this template and you can have a table format for all of your, let's say, GitHub repositories. Like you want someone to be able to find all of your GitHub repositories, the most important and interesting ones. You can add that as a tabular template. So these are like really cool, some base templates that you can start building with so you don't have to do anything from scratch.
All right. Now, let's go back to this. Make sure I didn't miss anything. Perfect. So I'm just recapping very quickly. What we did here is we created a new folder in the post tab. It had an index dot QMD and an image associated with it. You added and edited the YAML section, you added the description and whatever plot you wanted, and it shows up in your projects tab by default. Note, one thing that I'm missing is that this description is picked up by default. I did not give that in the YAML anywhere, but it gets default picked up from that first line of your post index dot QMD. So that's where this comes from. Oops.
There we go. So this is one thing that I want to show in that is so this is my post page. You see here that I not only have images, but instead of that image in YAML, if you just give a GIF or GIF, it would show up there as well.
Adding external links to projects
All right. Awesome. So the other thing that I had in my projects here was external links. So let's say when you sit down to build your website, you've been you've worked on a lot of projects already and you don't want to build from scratch the projects inside your website. You just want to be able to link your external projects in your website so that it's just, again, a very quick, minimal effort way to just update your website quickly. And if you see this, it links to an external link. How do you do that?
So in the project.qmd, instead of telling it that, hey, this page is a type of listing, I'm going to tell I'm just going to directly start adding content to the project.qmd page. So I'm going to say, OK, my title is Quarto Blog Data Visualization, Animation and Interactivity. That's my first blog title. Under that blog title, I'm going to divide my page into columns. I'm not going to say initially how many columns I'm just going to say I'm going I'm about to divide my page into columns. The first column with a 55 percent width has my description. So this is my first column has my description. My second column, just a little bit of gap. It has nothing. Just so my image and text are not too close to each other. And my third column right here with 40 percent, which is the leftover out of 100 percent, is my image. And that's how easy it is to just create this component.
I wrote the description myself because there was no default way. This one is picking up a description because we're not using a template here. We're giving our description. I tried to make it catchy enough so somebody would want to actually click on continue reading and then open that link and read about it. So that's how you can update that for my next for my next project. I wanted the opposite. So I again gave my title for the next project. I divided it into columns. And instead, this time I said my first column should have image, then gap, then my description. So just like that, I was able to customize the look of my page completely as I wanted it.
And there is just so much more syntax that you can play with here within a Quarto HTML. I'm not going to go over all of that, but I will have links later where you can learn how many more ways you can just update your projects page.
Basic portfolio structure complete
Perfect. So I want to take pause here to tell you that the basic structure of your portfolio website is done. You just created your portfolio website. You have your home page, which is your about section. You uploaded your resume either as a PDF or within the markdown. You uploaded your projects. And if you upload your projects that are already existing, then this would take like 10, 20 minutes. But by this time, you have all the basic components of a portfolio website ready and appear very cleanly.
So let me just show that to you here. You have your home. You have your projects and everything that you need on the home page. You also have ways to contact you. Everything as a basic component is ready. So now that we have that structure down pat, even if you didn't do anything else, the website by now using the base Quarto template looks clean. But let's customize it further if you want to. And that we're going to do.
Customizing navigation and search
OK, so if you remember, there were like these default tabs and I'm going to show you this here. The default links that were here were only GitHub and Twitter. Let's say you want to add all the links that we had added in the about our about page to that side as well. This is how you can do that. So on the right hand side, let me show that to you here. I'm going to now close all of this and work in Quarto.
So on the right hand side, you can add more links here just by giving it a different icon and a different. You can just keep on adding to this right hand side and give it the link. Right now, it's default to GitHub.com, but you can actually give it your own link.
Perfect. So you can do that. You can also add a search icon to your website. So the default when you try to build a website or a blog project, the default actually comes with the search option. And let me show you what that by default looks like. So let's say if you want to search your page and I want to go to my partly related document that I have created. So this is my partly document. But you saw that when I clicked on search, it overlays on top of the website. You can change that look as well within the Quarto YAML. So within the Quarto YAML. So if within your website component of your YAML, if you give search location, navigation bar type overlay, it will overlay. Let's look at some more options that you can use for the default search. So there's your overlay option and there is your text box option where you don't want to overlay. Really depends upon what look you want for your website. So it can just open up on the side right here as a text box and that's your text box template. There is a lot of other enhancements you can do to your search. Like if you go through this page, a lot of other changes that you can do as well.
Dark and light mode toggling
The next thing and I really like this accessibility feature is you can toggle, give the person reading your website to toggle between dark and light mode. Let's actually try this out here. So I'm going to just say right now my default theme is Cosmo, which is the theme. And there is only one theme. Instead, I'm going to go under theme and say, hey, I want a different theme for light. Keep it Cosmo. And for dark mode, I want the dark theme, which is also a default theme that Quarto has. So if I if I just add this button, Quarto by default adds a toggle because it knows you have two themes. Quarto knows that you want to give the person reading your website the option to toggle between the two. So it just adds this button. Now, let's say if you see there is a lot of differences between these two. My font size changed. My navigation bar colors change. Lots of things just changed.
But let's say I don't want that. I want both light and dark theme to have Cosmo as my theme. Like keep all the size and everything same. I just want to change the background color from white to gray or to black or whatever to a dark color. But that's all I want to do instead of just completely changing my theme. So you can do that as well. So here, instead of dark as a different theme, I'm going to give it this. So here, what I'm telling my Quarto.yaml is just keep the theme as Cosmo for both my light and dark mode, but in my dark mode, change a few things. And those few things I'm giving it in this new file I created called ThemeDarkCustom.scss.
Let me just show you what that file looks like. So this is my ThemeDarkCustom.scss. I think this is a very neat way to be able to customize a lot of things on your website like navigation color. But in this case, all I'm changing is my body background should become dark black. My body color, which is my font color, should be white and a few other things like my link color and my code block transparency. So if I just do that, let's go back to the viewer. I saved it. And you see here now nothing else is changing. I have Cosmo theme for both of those, but just a few things that I wanted to change about my theme are now being picked up from this.
So I'm going to show you a link here where you can change so many. This is where you can pick up your themes from. So I used Cosmo and Darkly initially for the example, but there are so many other themes that you can pick up based on what you like your website to look like. There is a lot of things here that if you go down, all the things that you can change in your SCSS files, which is also a lot of things you can change your font family size and a lot of other colors as well.
Code block customizations
OK, so now that we have customized the dark theme, they look just so much more similar. And this is what I did for my website because I like them to be the same. Everything just a few changes. All right. Let's come to code block customizations. So code blocks is within your projects. If we open this post with plot, you will see this. This is your code blocks. And there is so much customization that you can do here as well.
Let's try our first customization, which is code link true. So these code customizations are all still within the theme that we're doing it. So if you just change or if you just add code link true, this is like one of my favorite features under the theme. So again, because YAML is space sensitive, just make sure that you're adding it at an HTML level, your code link. So if you save it. Let's see here. You see here a link just got added. This feature is really cool because you if you click on this, the documentation of whatever function you're using just opens up that quickly. So this is a very cool feature and a very accessible feature for different levels of people that are reading your website.
So this is a very cool feature and a very accessible feature for different levels of people that are reading your website.
So just get them up to speed with what you're building. The code fold as show option. What that allows you to do is not. And I have an example right here. It just folds your code and gives the audience the option to open and open here and here, open and close the code. I'm going to just show that to you here. Now, if you do code folding your show, it means that by default it will show, but it also gives the option to fold the code so you can fold the code by default or not the next. If you are, however, giving the audience to fold your code, you want to also give them the option to either look at all the code together, like unfold or fold all of the code simultaneously so that they don't have to do that chunk by chunk. And that's where code tools comes in place. So when you add this code tools as true option, it adds this on top of your page and it has the option of showing all the code or hiding all the code at the same time. And if you it also has this cool feature for viewing the source, which means that, hey, if I'm just interested in looking at the code components of your website or of your page, particularly, you can just click on View Source Code and it just shows you that.
I'm not going to try all of these, but I just wanted to show you where you can put these examples to play with these SCSS options. So code blocks background is just as the word says, code block background. I gave it light blue. It's a very not my favorite color. Probably I won't do it for my website, but just wanted to show you this example of you can change your code block background. Add a border to your code to just make it look like easy to find. I have done this for my website where I added a border. I made it match the colors I wanted, but you can have a contrast to your navigation bar or however you want that.
However, if you don't want to change any background or border, but you want to pick up some default themes that are already there for your code, there's a really cool like lots of things that are available by default. If, let's say, you want to take a look at the example of GitHub theme, this is what it looks like. Quarto is smart enough that it's able to change that theme for a light and dark mode and match the code block to whatever theme of your page is. So it's able to. This is your light theme. This is your dark theme. GitHub is one of the options, but if you just click this link and go to the highlighting section, you have so many other themes. Breeze is one of my favorite themes, but you can just like play with these themes, see what looks good with your navigation bar, color, et cetera, that you picked.
Favicon and website footer
Awesome. So. All right. Very quickly, my favorite part of a website is to add a fav icon. And it is so easy to do in Quarto. If another website option, which is like right under this option, if you just say, hey, pick up a fav icon from this images LinkedIn pic folder. It just adds that right here. This is what your fav icon is. So you see here my website has this top head attached to it. You can have it your pet picture or whatever you wanted, but just gives it a unique picture versus having it like I have on my presentation, which is a globe which opens up for almost every website that you have if it's not customized. So I think it's a very cool feature that you can so easily add in Quarto to customize it to have your look.
All right. I also have website footers in my website, if you see here at homepage. And the reason I have them at website level is so that wherever the person goes, they have this handy. And that handy is just says made with Posit Quarto, contact Deepsha Minghani. So at any point in the while reading the website, they're like, oh, I want to talk to Deepsha Minghani. Or if any at any point on the website, they want to look at the GitHub repo for the website itself,
like how I have coded or built the website that opens up right away.
So that is also extremely easy to add here. And I'm going to just add that to show you right here.
So I just added a page footer section. I said, hey, in the center, contact Deepsha Minghani on the left hand side of my footer made with Quarto. On the right hand side, link to my GitHub repo and give it a background of this color. I can change that background to like whatever color I want.
Let's change that to red and it just changes to the red color. Probably won't have it. It's too bright, but you can change your background to any color. Awesome.
Publishing the website
Last step, we need to publish our website and I'm going to show an example of publishing this with Quarto Pub. So Quarto Pub is just one of the ways you can publish it, but it is one of the easier ways to easiest way to publish it.
And I'll show you that in a second. So in in your terminal, just type the command Quarto publish Quarto Pub. Now, if you just read this, the first thing it says is, hey, you have a Quarto Pub account. Do you want to publish it using that account? I'm going to say yes. So if I yes means I'm just going to press enter. I'm going to say yes. It says, oh, publish the name with Portfolio. I'm going to say, yeah. Like just publish that under the name of Portfolio. And that's it.
That's literally it. All you had to do to publish your website. So to recap, first, create a free account on Quarto.Pub. Sign in into your default browser so that your terminal is able to know that, oh, that's the Quarto Pub account that this person wants to use to publish their website. And then go to the terminal and get the command up. Looks like it just got published there.
This link is now publicly available. You can open this link and try it out. But that's how quick and easy it is to publish your thing. Go to the terminal and give the Quarto Publish Quarto Pub command and follow the instructions.
Updating the website
Now, updating your website. Let's say I have. This is not my favorite color for the navigation bar. I want to change that color. So I'm going to re-update the website. So this could be a bigger change than this. I'm just making a minor change. But let's say you added a brand new project. You updated a completely different resume. Whatever you want to do, you just make that edit. Go back to your terminal.
Again, get the same command of Quarto Publish Quarto Pub. And let me go here so you're able to see it. Quarto Publish Quarto Pub. And it is able to, by default, know that where had you published that project. So it asks you whether you want to publish these changes to the same website or you want to create a brand new website. So right now I want to just publish it to the same website. It's intelligent enough to know that. I'm going to just press yes. And that's it. That change is now just going to appear online.
So if I just have like some caveats about Quarto Pub that you need to know while publishing it using Quarto Pub is any website that you publish with it is publicly visible. It's published and the change is made. Now this is online. Any website that you publish with this is publicly visible. It has a limited size and bandwidth. I think all of that is OK for a portfolio website because you want it to be public.
It shouldn't be too heavy. It should have minimal material so that the people reading your website are able to actually find things and are not lost in the plethora of content that you may want to add. So not add every content, but have limited content on your portfolio website.
However, if that limitation is not something that you want, there are so many other ways you can publish your Quarto website. Using Quarto Pub, GitHub Pages is another way to publish it. Posit Connect allows you to have a private authentication so you can publish it publicly or also have a authentication added to your website and Netify. So based on your needs, see what is the way that you want to publish it.
I've linked here the page that goes over all the methods of publishing it. And if you click on those links, you will see what are the pros and cons of each of the publishing system and the steps on how to do that.
Useful links and resources
So we publish it. We have updated it. I want to place some useful links so that I can share what I use to create my website. These were some of the most useful links, which is beautiful reports and presentations with Quarto and building a blog with Quarto by Tom and Isabella from Posit Teams. They were really useful in just helping me understand how I can lay out the different pages inside my website.
If you forget how to publish with Quarto Pub, this is the best 100 seconds you will spend. There's a YouTube video also by Tom, which goes about how to publish using Quarto Pub in 100 seconds. And my portfolio, GitHub Repo, in case you want to use that as a template to just start building your website versus trying to build from scratch, feel free to use that template and then edit from there.
If you forget how to publish with Quarto Pub, this is the best 100 seconds you will spend.
So these are some of the useful links. And I want to just call out that you did it. If this content was useful in actually building a website, that's how easy it is to build a website from scratch with Quarto. So I can't believe I actually finished this content in time. Rachel.
Q&A
Thank you so much, Deepsha. That was amazing. Thank you for including all these links, too. I just put the link to the slides in the chat so everybody has access to them right away, too. But I do see a lot of questions. Let's see. I'm going to jump over to a few on YouTube first.
And thank you. I know you said you have some extra time over the top of the hour. So we will try to answer all the questions here. And if you can't stay on or miss your question, it will be included with the recording, too. So I just wanted everyone to know the recording is available immediately after it ends. It will just be at the same YouTube link.
And so one of the questions that I see. Asked by Marlene and hi, Marlene, is what about adding pre-existing R Markdown docs to your projects?
So I actually did have some content in R Markdown. So initially I had created my visualization blog using R Markdown. But I was easily able to most of the stuff, the code capabilities in R Markdown are backward compatible with Quarto Markdown. So I had to do minor changes to make it to a Quarto file and just update it. So most of the code would just run as it is with very little intervention in Quarto Markdown as well.
Regarding actually just pasting a major .RMD, I haven't tried it. So I can't confirm if you can just put an RMD and it'll work as it is. But I would I changed mine to QMD and uploaded it.
Thank you. And I see a lot of people really love this question and started plus wanting it and adding on to it. Is there any way to integrate Shiny app into a Quarto website?
Yes, I actually tried that a few weeks ago for a Tidy Tuesday post where I learned how to incorporate Shiny and Quarto. It is it should be in my GitHub Tidy Tuesday. You will able to find you'll be able to find in either one of the 2022 or 2023 presentations. But it's so easy to do. You can. Quarto has really good links where you're able to learn how to incorporate the Shiny in Quarto Markdown.
I will add the caveat, though. You want your portfolio website to be really fast and shiny as as awesome as it is to incorporate in Quarto. Might slow down the not not the rendering, but the actual loading of the website when somebody comes to that page. So see how incorporating that impacts your website speed. And if it doesn't go for it. But it is it is very easy to incorporate Shiny into your Quarto Markdown directly.
One thing on the note of speed is as you're building your website, add a added component by component so that not like every component. And then publish your website, publish it multiple times to see if you added one component. What happens to the speed of your website if you added the next one? What happens so that you're able to find the bottleneck more easily when you're creating your website?
Thank you. Another question, I know you just touched on a little bit towards the end about publishing options. Somebody asked, can you publish a Quarto website internally?
So I know and maybe the Quarto team might best answer it, but I know that with Posit Connect, you can just publish your website internally and also have internal authentication. So it's like even at organization level, you can have authentications. So you can definitely do that.
Thank you. And we can share our team can share a few options on publishing in the chat in just a second here to another. Let me go over to some of the Slido questions. And one of the questions there was, is there support for multi language websites on Quarto?
Yes, I am actually going to right now, my website is primarily in R, but I'm going to incorporate Python into it as well. And you can do that within the same Quarto markdown. So you can, let's say, call an API using Python and then pull that API output into our data frame and then plot it using R or ggplot.
Nicola Rennie wrote a really amazing blog very recently. If you're not following them, amazing content comes out of their Twitter and Mastodon links. So find Nicola Rennie's article on how to use Quarto to write R and Python code. But it is totally doable and easy to do.
Oh, I forgot to call out reticulate is the package that you would use to like talk between Python and R. So you can either have a silo Python document, a silo R document. But if you want them to talk to each other, you would use a reticulate package to make R and Python talk to each other.
Great, thank you. And I see some chat happening behind the scenes, too. And Curtis had shared with me that Minay and Julia's keynote at the last conference talked about NASA building a website in both R and Python. Some pages were Python notebooks, some were Quarto docs. So I just want to say that so Curtis could share it in the chat as well.
And for the previous question, I also just posted the shiny Quarto and shiny Tidy Tuesday that I had tried in our private chat, if anybody wants to take a look at that. Perfect. I just copied that over.
And then I wanted to also add, because I wasn't sure at first if multilanguage meant R and Python or if multilanguage also meant, for example, like English, Spanish, French. And so I have Carlos helping behind the scenes from the Quarto team as well. And he did say we have support for this where users can choose different languages for different documents. But right now it's not multiple languages for a single document. And so he shared a link to GitHub discussions if you wanted to go over there, too. I'm just going to put that in the chat as well. That's a really cool question. I did not know Quarto could do that. So I'll keep an eye out for it as well.
Another question over on Slido was, can we create a projects tab that points to other index projects in other repos hosted as GitHub pages? I'm just going to make sure. Can we create a project tab that points to other index projects in other repos hosted as GitHub pages?
I'm not sure about that answer. But in my website, if you go into the projects tab, it actually links to external stuff. So maybe that way you can link it to external project that you published using GitHub pages. So that could be one way that you could do it, if I understood the question correctly.
Thank you very much. And I'm copying questions over for us to save for the recording as well. But I see for this question as well, Carlos had added, yes, there's support for custom listings, but it takes more than 200 characters to explain. So he linked to the full docs as well. Oh, sorry, I'm reposting. I see Carlos already put it there. Thank you.
Awesome. Let me jump back over to YouTube here. And one other question. Let's see. I'm trying to make sure I don't ask something similar.
Here we go. Here's another one. What is the difference between Quarto website, blog, and other Quarto formats? So I can definitely talk about website and blog. A blog is a type of website in Quarto terms. So when you create a website project or you create a blog project, you're still creating the type of project called website. The reason I chose to create a blog project, because when you create a website project, it gives you a blank slate to start building from there.
But when you create a blog project, it had all those files like Quarto.yaml and everything by default. That was very quick for me to format to get it to where I wanted it for my project. But blog is a type of website. With blog, you just have components ready to go as it is. And with website, you are building it the way you want it to from scratch.
Great. Thank you. Another question over on Slido was, is it free to deploy a website from Quarto platform? I have a portfolio website deployed from GitHub. Is it possible to use Quarto and deploy it from GitHub? Use Quarto to deploy it? I have tried deploying a website from GitHub pages separately. Usually, if it's a Quarto type of project, you should be able to deploy the same thing in Quarto.pub as well. But not simultaneously, as far as I know.
But if it's a Quarto project, you can deploy the same website that you did from GitHub. I think your question is the same website, just publish it on Quarto.pub. I'm not sure. And to answer the first question, is it free to deploy on Quarto.pub? Yes, you can deploy your own website over there right now. And that's where Deepsha's site actually lives today. So if you see the slides and the link that we shared, you'll see it's a Quarto.pub link.
Okay, let me go jump back over to Slido. Oh, and this kind of touches on that as well. Somebody had asked, does this portfolio live in the cloud? Do you need a hosted site to accomplish this? I have to do nothing to maintain it, which is the biggest reason that I'm using Quarto.pub. It's in the backend. I don't have to do anything. It's not a server that it stops. So it's all in the backend, done and maintained. You can easily update your site, and you don't have to know what's happening in the backend for that.
I have to do nothing to maintain it, which is the biggest reason that I'm using Quarto.pub.
Awesome. One other question that just came in on Slido is, can you embed a Quarto book into a Quarto website or blog? A Quarto book into a website or a blog? I have tried a Quarto doc into a website, and I was easily able to do that. I think you should be able to do a book. If you're using any of the text, et cetera, I don't know. You can just incorporate that in there. But if there's any book down specific features, most of them are just compatible with the Quarto markdown.
I did that for my resume. I actually created a doc X, and I was easily able to put that exact same thing to my Quarto. Some features might differ that you can see how different they are. And if that's a deal breaker to change them. But it should be doable.
Theming and customization
I saw a lot of questions and conversations in the YouTube chat around theming as well. And I think one was, is it possible to create my own theme? And I see Carlos has shared a link there as well and said, yes, it totally is. You do need to know SCSS though. But there's some docs there as well. Yeah. And the links that I shared as one of the footers. There is just so much SCSS that's available on that page that there is a lot of custom theming that you can do from just that page. And then you can learn SCSS in different ways. But that page itself has so much content you can use to customize your theme however you want.
Learning Quarto
So I was curious because I know you had recently learned Quarto and just gave this awesome talk. What was most helpful for you in learning Quarto? I think the talks that your team did with Tom and Isabella, I think was just super helpful. The flexibility of everything that you could do. They did such a great job in showing how flexible Quarto can be. Like I just had so much fun with playing with images. How to make the images lay on top of each other or come up in a fragmented manner. So there's just so much I could do with Quarto. Playing with it after seeing those presentations just made it so much easier.
I would definitely agree. I don't consider myself a data scientist at all. And I found it really fun to start making a website with Quarto too.
I see a lot of people saying thank you so much. This was an amazing presentation. Great talk. A lot of people saying how incredible it was. So thank you so much, Deepsha. If there are some questions that we didn't get to, I just wanted to give people one chance here to repost that into the YouTube chat. I'm sorry if I missed anything there.
But I know all these links that we've been sharing in the chat today we'll put together with the recording as well so that you'll have them all there. As well as Deepsha's slides. And all of the links in her slides.
I think we're good on questions. Thank you so much, Deepsha. I really, really appreciate it. And you taking the time to answer all these questions too. Thank you so much, Rachel. Thank you.
I see somebody was asking real quick for one of the links that we had mentioned for a conference talk. So I'm going to share that into the chat here right now. Have a great rest of the day, everybody. Thank you.