
Analog User Guide - Configuring It
Published on · Edited on

Hogwarts School
Magic school for young wizards
Previous Article
Analog User Guide - How to Create ContentNext Article
Analog User Guide - Get StartedTable of Contents
Analog's default configuration file is /data/site-config.ts
. This file contains all the configurations for your blog, including the site's metadata, navigation, analytics, comment system, and more.
Configuration File
The user configuration file /data/site-config.ts
is written in TypeScript. It will be merged with the default configuration file /src/lib/site-config.ts
to generate the final configuration object.
In this article, I will explain the fields in your user configuration file and how to set them up. Also, you can refer to the default configuration file.
Metadata of Your Blog
The metadata of the site will be used in the meta tags of the website and may be captured by search engine robots, etc.
Site URL - siteUrl
The siteUrl
field is the URL of your website. It must start with https://
or http://
. If your site is hosted on a subdirectory, you should add the subdirectory path to the URL, such as https://example.com/blog
.
Site Root - siteRoot
The siteRoot
field is the root path of your website. If your site is hosted on a subdirectory, you should add the subdirectory path to the URL, such as /blog
. This field is used to generate the correct path for assets, so you may find broken post banners or avatars if it is not set correctly.
By default, it is set to the environment variable BASE_PATH
in the build process.
When deploying to GitHub Pages, the BASE_PATH
is set to the repository name by the built-in Action.
Site Title - siteTitle
The siteTitle
field is the title of your website.
Site Description - description
The description
field is a brief description of your website.
Site Locale - locale
The locale
field is the locale of your website. It is used to set the language of your website. The format is language-COUNTRY
, such as en-US
or zh-CN
.
Author Name - author
The author
field is the name of the author of the website. It will also be displayed in your homepage greetings.
Keywords - keywords
The keywords
field is an array of keywords used for SEO and social media. It is unnecessary for most modern sites, I recommend leaving it blank.
Posts Per Page - pagination
The pagination
field is the number of posts displayed per page on the homepage and archive pages. The default value is 10
.
Homepage
Greetings - homepage.greetings
The homepage.greetings
field is an array of greetings displayed on the homepage.
GitHub Calendar - homepage.githubCalendar
The homepage.githubCalendar
field determines whether to display a GitHub contribution wall on the homepage. Keep it blank to disable the GitHub calendar.
Sections - homepage.sections
The homepage.sections
field is an array of sections displayed on the homepage. The default value is []
. You can refer to the configuration file of this demo site for examples of how to set up different sections.
Currently, Analog has provides three section types:
HomepageSectionContents.LatestNews
: Latest news section.HomepageSectionContents.RecentPosts
: Recent post list section.HomepageSectionContents.PopularTags
: Popular post tags section.
To create your own custom sections, you can refer to the implementation of the above three sections.
Site Header
Header Logo - header.logo
The header.logo
field is the path to the logo image displayed in the header. It should be a absolute path from the root of the website (i.e., the public
folder).
Header Title - header.title
The header.title
field is the title displayed in the header.
At least one of the header.logo
or header.title
fields must be filled.
Header Navigation Menu - header.menu
The header.menu
field is an array of objects that define the navigation menu items in the header.
Have a look at the header of this demo site for reference.
Site Footer
Footer Social Icons - footer.icons
The footer.icons
field contains social icons displayed in the footer. For each icon, the key is the name of the icon, the icon
field is the React name of Tabler Icons, and the href
field is the link to the social media or other pages.
Have a look at the footer of this demo site for reference.
Bei-An Number - footer.beian
The footer.beian
field is the Bei-An number of your website. It is only necessary for websites hosted in mainland China.
Pages
Team Page Support - pages.team
The pages.team
field is a boolean value that determines whether to have a team page at /team
. The default value is true
. Note that only when there are authors besides the default author, the team page will be generated.
If true
, all authors will be classified according to their folder path and displayed on the team page. You can refer to the team page of this demo site for reference.
Page Greetings - pages.greetings
The pages.greetings
fields is an object that contains greetings for different pages. You can customize the greetings for the about
, archive
, tags
, and team
pages.
The pages.greetings.otherDefault
field is the default greeting for other user pages. To override it, you have to set the greeting
field in the front-matter of the MDX files.
Post License
The license
field is the default license of the posts. You can choose from the following 7 Creative Commons licenses:
cc-by-nc-sa
: CC BY-NC-SA 4.0cc-by-nc-nd
: CC BY-NC-ND 4.0cc-by-nc
: CC BY-NC 4.0cc-by-sa
: CC BY-SA 4.0cc-by-nd
: CC BY-ND 4.0cc-by
: CC BY 4.0cc0
: CC0 1.0
You can visit the Creative Commons website to find the license you want.
It will display the license information at the bottom of each post. Leave it blank to disable the license display.
SEO
Default Social Banner - seo.socialBanner
The seo.socialBanner
field is the path to the default social banner image of the website. It should be a absolute path from the public
folder.
This banner will be used when sharing the website on social media platforms, such as Twitter and Facebook.
Open Graph & Twitter Card
Analog will automatically generate Open Graph and Twitter Card meta tags for each post. You can customize these values in the configuration file to override them.
In most cases, you don't need to set these fields.
Web Analytics System
Visit the Analytics documentation for more information.
Comment System
Visit the Comment System documentation for more information.
MDX Front-matter
You can also specify the configuration for each post in the front-matter of the MDX file.
Front-matter is a block of YAML or JSON at the beginning of the MDX file that specifies the metadata of the post. Here is an example of the front-matter:
See Writing for more information about the front-matter.
Analog User Guide - Configuring It
https://analog-demo.zhutmost.com/post/doc/configuration