use readme.md instead of index.md

This commit is contained in:
Akbar Rahman 2024-01-02 18:20:47 +00:00
parent 8b4765e9fb
commit fddbbf4c50
Signed by: alvierahman90
GPG Key ID: 6217899F07CA2BDF
2 changed files with 9 additions and 9 deletions

View File

@ -118,8 +118,8 @@ class FileMap:
'tags': [], 'tags': [],
} }
if 'index.md' in [f.name for f in filepath.iterdir()]: if 'readme.md' in [f.name for f in filepath.iterdir()]:
with open(filepath.joinpath('index.md'), with open(filepath.joinpath('readme.md'),
encoding='utf-8') as file_pointer: encoding='utf-8') as file_pointer:
for key, val in frontmatter.load( for key, val in frontmatter.load(
file_pointer).to_dict().items(): file_pointer).to_dict().items():
@ -358,7 +358,7 @@ def process_home_index(args, notes_git_head_sha1=None):
""" """
post = {'title': 'gronk', 'content': ''} post = {'title': 'gronk', 'content': ''}
custom_content_file = args.notes.joinpath('index.md') custom_content_file = args.notes.joinpath('readme.md')
if custom_content_file.is_file(): if custom_content_file.is_file():
fmpost = frontmatter.loads(custom_content_file.read_text()).to_dict() fmpost = frontmatter.loads(custom_content_file.read_text()).to_dict()
for key, val in fmpost.items(): for key, val in fmpost.items():
@ -487,8 +487,8 @@ def main(args):
# render each file # render each file
for file in files: for file in files:
# don't render index.md as index as it is used for directory # don't render readme.md as index as it is used for directory
if file == "index.md": if file == "readme.md":
continue continue
render_file(root.joinpath(file)) render_file(root.joinpath(file))

View File

@ -53,7 +53,7 @@ Set the following environment variables (or create a .env file) and run `docker
## Custom Directory Index and Metadata ## Custom Directory Index and Metadata
To add custom content to a directory index, put it in a file called `index.md` under the directory. To add custom content to a directory index, put it in a file called `readme.md` under the directory.
You can set the following frontmatter variables to customise the directory index of a directory: You can set the following frontmatter variables to customise the directory index of a directory:
@ -61,7 +61,7 @@ You can set the following frontmatter variables to customise the directory index
|------------------------|-------------------|--------------------------------------------------------------------------------------------| |------------------------|-------------------|--------------------------------------------------------------------------------------------|
| `tags` | `[]` | list of tags, used by search and inherited by any notes and subdirectories | | `tags` | `[]` | list of tags, used by search and inherited by any notes and subdirectories |
| `uuid` | none | unique id to reference directory, used for permalinking | | `uuid` | none | unique id to reference directory, used for permalinking |
| `content_after_search` | `false` | show custom content in `index.md` after search bar and directory index | | `content_after_search` | `false` | show custom content in `readme.md` after search bar and directory index |
| `automatic_index` | `true` | show the automatically generated directory index. required for search bar to function. | | `automatic_index` | `true` | show the automatically generated directory index. required for search bar to function. |
| `search_bar` | `true` | show search bar to search directory items. requires `automatic_index` (enabled by default) | | `search_bar` | `true` | show search bar to search directory items. requires `automatic_index` (enabled by default) |
@ -99,8 +99,8 @@ a file called `styles.css`.
To add additional styling, the default styling will attempt to import `styles.css` from the root of the notes To add additional styling, the default styling will attempt to import `styles.css` from the root of the notes
directory. directory.
To add additional content to the homepage, create a file called `index.md` at the top level of your notes directory. To add additional content to the homepage, create a file called `readme.md` at the top level of your notes directory.
To set the HTML `title` tag, set `title` in the frontmatter of `index.md`: To set the HTML `title` tag, set `title` in the frontmatter of `readme.md`:
```markdown ```markdown
--- ---