Add a New Author
Authors allow you to attribute content to specific contributors, enhancing credibility and providing additional context for your website. Follow these steps to add a new author in Try-O-Theme.
Step 1: Navigate to the Authors Directory
- Open your project directory.
- Go to the src/contents/authors/ folder. This folder contains all author-related content.
Step 2: Create a New Author Directory
- Create a new directory for your author:
- Name the folder based on the author’s name. For example:
mkdir src/contents/authors/john-doe
- Use lowercase letters and hyphens for consistency in folder naming.
- Name the folder based on the author’s name. For example:
Step 3: Add an index.md File
- Inside the new directory (e.g., src/contents/authors/john-doe), create a file named index.md.
- This file stores the author’s metadata.
- Add the following content to the index.md file:
Fields Explanation:--- type: author title: John Doe description: "Tech Blogger and Writer" image: ./assets/john-doe.jpg priority: 1 linkedin: "https://www.linkedin.com/in/johndoe/" twitter: "https://twitter.com/johndoe" ---
- type: Always set to author.
- title: The display name of the author.
- description: A short bio of the author.
- image: Path to the author’s profile picture (relative to the author’s directory).
- priority: Specifies the display order of authors, with lower numbers appearing first.
- linkedin: Add the author’s LinkedIn profile URL (optional).
- twitter: Add the author’s Twitter handle (optional).
Step 4: Add a Profile Picture
- Inside the author’s directory, create an assets folder:
mkdir src/contents/authors/john-doe/assets
- Place a profile picture named cover.jpg (or the filename specified in the image field) inside the assets folder.
Step 5: Regenerate the Site
After creating the author, you need to regenerate your site to apply the changes:
- Open your terminal and navigate to your project directory.
- Run the following command:
toucan generate
- This updates the site’s content and templates to include the new author.
Step 6: Verify the Author
- Start the local development server:
toucan serve
- Open your browser and go to http://localhost:3000.
- Go to the Authors page to verify that the new author is displayed.
Additional Notes
- Using Authors in Posts:
- To assign an author to a post, include their folder name in the authors field of the post’s index.md file.
authors: - john-doe
- To assign an author to a post, include their folder name in the authors field of the post’s index.md file.
- Styling Author Profiles:
- To customize the author display, modify the relevant Mustache template in the src/themes/default/templates/ directory.
This guide ensures you can easily add and manage authors in Try-O-Theme.