Skip to content
Go back

How to configure AstroPaper theme

Updated:  at  10:15 AM

AstroPaper is a highly customizable Astro blog theme. With AstroPaper, you can customize everything according to your personal taste. This article will explain how you can make some customizations easily in the config file.

Table of contents

Open Table of contents

Configuring SITE

The important configurations resides in src/config.ts file. Within that file, you’ll see the SITE object where you can specify your website’s main configurations.

During development, it’s okay to leave SITE.website empty. But in production mode, you should specify your deployed url in SITE.website option since this will be used for canonical URL, social card URL etc.. which are important for SEO.

// file: src/config.ts
export const SITE = {
  website: "https://astro-paper.pages.dev/", // replace this with your deployed domain
  author: "Sat Naing",
  profile: "https://satnaing.dev/",
  desc: "A minimal, responsive and SEO-friendly Astro blog theme.",
  title: "AstroPaper",
  ogImage: "astropaper-og.jpg",
  lightAndDarkMode: true,
  postPerIndex: 4,
  postPerPage: 4,
  scheduledPostMargin: 15 * 60 * 1000, // 15 minutes
  showArchives: true,
  showBackButton: true, // show back button in post detail
  editPost: {
    enabled: true,
    text: "Suggest Changes",
    url: "https://github.com/satnaing/astro-paper/edit/main/",
  },
  dynamicOgImage: true, // enable automatic dynamic og-image generation
  lang: "en", // html lang code. Set this empty and default will be "en"
  timezone: "Asia/Bangkok", // Default global timezone (IANA format) https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
} as const;

Here are SITE configuration options

OptionsDescription
websiteYour deployed website URL
authorYour name
profileYour personal/portfolio website URL which is used for better SEO. Put null or empty string "" if you don’t have any.
descYour site description. Useful for SEO and social media sharing.
titleYour site name
ogImageYour default OG image for the site. Useful for social media sharing. OG images can be an external image URL or they can be placed under /public directory.
lightAndDarkModeEnable or disable light & dark mode for the website. If disabled, primary color scheme will be used. This option is enabled by default.
postPerIndexThe number of posts to be displayed at the home page under Recent section.
postPerPageYou can specify how many posts will be displayed in each posts page. (eg: if you set SITE.postPerPage to 3, each page will only show 3 posts per page)
scheduledPostMarginIn Production mode, posts with a future pubDatetime will not be visible. However, if a post’s pubDatetime is within the next 15 minutes, it will be visible. You can set scheduledPostMargin if you don’t like the default 15 minutes margin.
showArchivesDetermines whether to display the Archives menu (positioned between the About and Search menus) and its corresponding page on the site. This option is set to true by default.
showBackButtonDetermines whether to display the Go back button in each blog post.
editPostThis option allows users to suggest changes to a blog post by providing an edit link under blog post titles. This feature can be disabled by setting SITE.editPost.enabled to false.
dynamicOgImageThis option controls whether to generate dynamic og-image if no ogImage is specified in the blog post frontmatter. If you have many blog posts, you might want to disable this feature. See the trade-off for more details.
langUsed as HTML ISO Language code in <html lang"en">. Default is en.
timezoneThis option allows you to specify your timezone using the IANA format. Setting this ensures consistent timestamps across your localhost and deployed site, eliminating time differences.

Configuring logo or title

Prior to AstroPaper v5, you can update your site name/logo in LOGO_IMAGE object inside src/config.ts file. However, in AstroPaper v5, this option has been removed in favor of Astro’s built-in SVG and Image components.

An arrow pointing at the website logo

There are 3 options you can do:

Option 1: SITE title text

This is the easiest option. You just have to update SITE.title in src/config.ts file.

Option 2: Astro’s SVG component

You might want to use this option if you want to use an SVG logo.

The best part of this approach is that you can customize your SVG styles as needed. In the example above, you can see how the SVG logo color can be inverted in dark mode.

Option 3: Astro’s Image component

If your logo is an image but not SVG, you can use Astro’s Image component.

With this approach, you can still adjust your image’s appearance using CSS classes. However, this might not always fit what you want. If you need to display different logo images based on light or dark mode, check how light/dark icons are handled inside the Header.astro component.

You can configure social links in SOCIALS object inside src/constants.ts.

An arrow pointing at social link icons

export const SOCIALS = [
  {
    name: "Github",
    href: "https://github.com/satnaing/astro-paper",
    linkTitle: ` ${SITE.title} on Github`,
    icon: IconGitHub,
  },
  {
    name: "X",
    href: "https://x.com/username",
    linkTitle: `${SITE.title} on X`,
    icon: IconBrandX,
  },
  {
    name: "LinkedIn",
    href: "https://www.linkedin.com/in/username/",
    linkTitle: `${SITE.title} on LinkedIn`,
    icon: IconLinkedin,
  },
  {
    name: "Mail",
    href: "mailto:yourmail@gmail.com",
    linkTitle: `Send an email to ${SITE.title}`,
    icon: IconMail,
  },
] as const;

You can configure share links in SHARE_LINKS object inside src/constants.ts.

An arrow pointing at share link icons

Conclusion

This is the brief specification of how you can customize this theme. You can customize more if you know some coding. For customizing styles, please read this article. Thanks for reading.✌🏻


Suggest Changes

Previous Post
Adding new posts in AstroPaper theme
Next Post
Dynamic OG image generation in AstroPaper blog posts