Skip to content

Commit 770c8cb

Browse files
committed
feat: doc/build, doc/install
Problem: Currently, BUILD.md and INSTALL.md are only available on github. Solution: Copy them to `content/doc2/` and let Hugo render them.
1 parent 8d55838 commit 770c8cb

File tree

7 files changed

+50
-100
lines changed

7 files changed

+50
-100
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ This repository contains the source for the neovim.io website.
88

99
Just fork this repository and send us a pull request! :-)
1010

11-
To embed raw html:
12-
13-
{{< rawhtml >}}
14-
<lol>
15-
{{< /rawhtml >}}
16-
1711
## Setup
1812

1913
This site is statically generated using Hugo. It takes one minute to get setup,
@@ -33,8 +27,11 @@ just do the following:
3327

3428
Notes:
3529

36-
- www.neovim.io/doc is served by https://github.com/neovim/doc (which previously
37-
crawled neovim.io/doc2 generated from this repository).
30+
- Updating `content/doc2/` currently requires a human to run: `./sync_docs.sh`
31+
- Files in `content/doc2/` are synced to https://github.com/neovim/doc/ by
32+
[this CI job](https://github.com/neovim/doc/blob/4ab2e06af98dadbd35c4282c1b18304d87f8eb59/ci/doc-index.sh#L10-L13).
33+
- This is because `neovim.io/doc/` is served by https://github.com/neovim/doc/
34+
(where the user documentation HTML is published).
3835
- Site search (for `:help` docs) is served by [Algolia Docsearch](https://docsearch.algolia.com/).
3936
- The javascript and UI container were setup in [this commit](https://github.com/neovim/neovim.github.io/commit/ce9aef12eb1c98135965e3a9c5c792bf9e506a76).
4037
- The docs pages don't use the layout so they also need to [manually include](https://github.com/neovim/neovim/pull/23839) the javascript and define a UI container.

content/community.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

content/doc2/index.html renamed to content/doc2/_index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Documentation
33
active: Documentation
4-
type: default
4+
layout: single
55
---
66

77
<section class="front-section">
@@ -12,10 +12,10 @@ <h1>Documentation</h1>
1212
<div>
1313
<h2>User</h2>
1414

15-
<h3><a href="https://github.com/neovim/neovim/blob/master/INSTALL.md">Install</a></h3>
15+
<h3><a href="/doc/install">Install</a></h3>
1616
<p>
1717
<a href="https://github.com/neovim/neovim/releases">Download a binary</a>
18-
or use a <a href="https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package">package manager</a>.
18+
or use a <a href="/doc/install#install-from-package">package manager</a>.
1919
</p>
2020

2121
<h3>
@@ -37,7 +37,7 @@ <h2>Developer</h2>
3737

3838
<h3>Resources</h3>
3939
<ul>
40-
<li><a href="https://github.com/neovim/neovim/blob/master/BUILD.md">Building Nvim from source</a></li>
40+
<li><a href="/doc/build">Building Nvim from source</a></li>
4141
<li><a href="https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md">Contributing to Neovim</a></li>
4242
<li><a href="https://neovim.io/doc/user/dev.html#dev"><code>:help dev</code></a> guidelines and design constraints</li>
4343
<li><a href="https://neovim.io/doc/user/dev_tools.html#dev-tools"><code>:help dev-tools</code></a> tools and techniques</li>

content/screenshots.html

Lines changed: 0 additions & 58 deletions
This file was deleted.

layouts/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<section class="masthead">
33
<h1 class="lead">hyperextensible Vim-based text editor</h1>
44
<p>
5-
<a href="https://github.com/neovim/neovim/blob/master/INSTALL.md" class="btn">Install Now</a>
5+
<a href="/doc/install" class="btn">Install Now</a>
66
<a href="https://dotfyle.com/plugins" class="btn">Get Plugins</a>
77
</p>
88
</section>

static/doc2/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

sync_docs.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# This script syncs files from Neovim core, to content/doc2/:
4+
# - BUILD.md
5+
# - INSTALL.md
6+
#
7+
# After Hugo publishes the rendered HTML from content/doc2/, the files are
8+
# later copied from doc2/ to doc/ by this CI task:
9+
# https://github.com/neovim/doc/blob/main/ci/doc-index.sh
10+
11+
set -eu
12+
13+
# Add Hugo markdown header.
14+
add_frontmatter() {
15+
local file="$1"
16+
local title="$2"
17+
18+
cat > "$file.tmp" <<EOF
19+
---
20+
title: $title
21+
type: page
22+
---
23+
24+
EOF
25+
cat "$file" >> "$file.tmp"
26+
mv "$file.tmp" "$file"
27+
}
28+
29+
curl -Lo content/doc2/build.md https://raw.githubusercontent.com/neovim/neovim/refs/heads/master/BUILD.md
30+
add_frontmatter content/doc2/build.md "Build"
31+
# Replace INSTALL.md hyperlinks with "./install".
32+
sed -i '' 's/INSTALL\.md/\.\.\/install/g' content/doc2/build.md
33+
34+
curl -Lo content/doc2/install.md https://raw.githubusercontent.com/neovim/neovim/refs/heads/master/INSTALL.md
35+
add_frontmatter content/doc2/install.md "Install"
36+
# Replace BUILD.md hyperlinks with "./build".
37+
sed -i '' 's/BUILD\.md/\.\.\/build/g' content/doc2/install.md
38+
39+
git add content/doc2/
40+
git commit -m 'update content/doc2/ files from neovim/neovim repo'

0 commit comments

Comments
 (0)