Beautiful Website for Your Projects
Table of Contents
- Getting Started
- Using Your own Template
- Building Multiple Pages
- Helper Functions for Markdown
- Code of Conduct and Contributing
- What Happened to it Generating a Blog
- License - MIT
- No configuration requrired. Just setup the folder structure with a logo, favicon, and css file.
- Builds a static website that can be hosted anywhere.
- For more complex projects easily add a
writr.config.tsfile to customize the build process. With PRE and POST methods.
- Support for single page with readme or multiple markdown pages in a docs folder.
- Will generate a sitemap.xml and robots.txt for your site.
- Uses Github release notes to generate a changelog / releases page.
- Uses Github to show contributors and link to their profiles.
- Simple search is provided by default out of the box.
1. Install Writr
npx writr init
This will create a folder called site with the following structure:
Note: for typescript do 'writr init --typescript'
2. Add your content
Simply replace the logo, favicon, and css file with your own. The readme is your root project readme and you just need to at build time move it over to the site folder. If you have it at the root of the project and this is a folder inside just delete the README.md file in the site folder and writr will copy it over for you automatically.
3. Build your site
This will build your site and place it in the
dist folder. You can then host it anywhere you like.
Using Your own Template
If you want to use your own template you can do so by adding a
writr.config.ts file to the root of your project. This file will be used to configure the build process.
or at the command line:
npx writr --template path/to/template
Building Multiple Pages
If you want to build multiple pages you can easily do that by adding in a
docs folder to the root of the site folder. Inside of that folder you can add as many pages as you like. Each page will be a markdown file and it will generate a table of contents for you. Here is an example of what it looks like:
readme.md file will be the root page and the rest will be added to the table of contents. If you want to control the title or order of the pages you can do so by setting the
order properties in the front matter of the markdown file. Here is an example:
title: Getting Started
Helper Functions for Markdown
Writr comes with some helper functions that you can use in your markdown files.
writrHelpers.getFrontMatter(fileName)- Gets the front matter of a markdown file.
writrHelpers.setFrontMatter(fileName, frontMatter)- Sets the front matter of a markdown file.
writrHelpers.createDoc(source, destination, frontMatter?, contentFn?)- Creates a markdown file with the specified front matter and content. The contentFn is a function that is executed on the original content of the file. This is useful if you want to remove content from the original file.
Remove html content
In some cases your markdown file will have html content in it such as the logo of your project or a badge. You can use the
wrtirHelpers.removeHtmlContent() helper function to remove that content from the page. Here is an example:
Get and Set the Front Matter of a Markdown File
You can use the
writrHelpers.setFrontMatter() helper functions to get and set the front matter of a markdown file. Here is an example:
const frontMatter = writrHelpers.getFrontMatter('../readme.md');
frontMatter.title = 'My Title';
Code of Conduct and Contributing
What Happened to it Generating a Blog
The original version of writr was a blog generator. Since there are plenty of blog generators out there we made the decision to make it a static site generator for open source projects. This is something that we constantly need and we hope you find it useful as well.
MIT © Jared Wray
- upgrading typescript ts-node and @types/node to latest by @jaredwray in https://github.com/jaredwray/writr/pull/188
- upgrading ecto to 2.1.12 by @jaredwray in https://github.com/jaredwray/writr/pull/189
- upgrading commander to 11.0.0 by @jaredwray in https://github.com/jaredwray/writr/pull/190
Full Changelog: https://github.com/jaredwray/writr/compare/v1.9.9...v1.9.10
- upgrading ecto to 2.1.11 by @jaredwray in https://github.com/jaredwray/writr/pull/183
- upgrading @types/node to 20.2.5 by @jaredwray in https://github.com/jaredwray/writr/pull/184
- upgrading winston to 3.9.0 by @jaredwray in https://github.com/jaredwray/writr/pull/185
- upgrading browser-sync to 2.29.3 by @jaredwray in https://github.com/jaredwray/writr/pull/186
- upgrading types to the latest by @jaredwray in https://github.com/jaredwray/writr/pull/187
Full Changelog: https://github.com/jaredwray/writr/compare/v1.9.8...v1.9.9
- upgrading typescript and types to latest by @jaredwray in https://github.com/jaredwray/writr/pull/178
- upgrading parse-json to 7.0.0 by @jaredwray in https://github.com/jaredwray/writr/pull/179
- upgrading ecto to 2.1.10 by @jaredwray in https://github.com/jaredwray/writr/pull/180
- upgrading commander to 10.0.1 by @jaredwray in https://github.com/jaredwray/writr/pull/181
- upgrading axios to 1.4.0 by @jaredwray in https://github.com/jaredwray/writr/pull/182
Full Changelog: https://github.com/jaredwray/writr/compare/v1.9.6...v1.9.8