Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website: exclude files that would cause problems for prebuild or jekyll #4810

Merged
merged 6 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions website/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ theme: just-the-docs

favicon_ico: '/favicon.png'

exclude:
- '.*'
- '**/node_modules'
- '**/dist'
- 'bazel-*'
- 'utils/vscode/images/icon.png'

aux_links:
Discord: https://discord.gg/ZjVdShJDAs
GitHub: https://github.com/carbon-language/carbon-lang
Expand Down
22 changes: 14 additions & 8 deletions website/prebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,23 @@ def label_subdir(
readme = subdir / "README.md"
readme_content = readme.read_text()

def include_child(md_file: Path) -> bool:
"""Returns whether md_file is a child of this label."""
# The top-level README.md isn't a child.
if md_file == readme:
return False
# Skip directories that aren't part of the repository.
if "/node_modules/" in str(md_file):
return False
if "/dist/" in str(md_file):
return False
return True

readme_title = get_title(readme, readme_content)
readme_titles = [readme_title]
if parent_title:
readme_titles.insert(0, parent_title)
children = [x for x in subdir.glob("**/*.md") if x != readme]
children = [x for x in subdir.glob("**/*.md") if include_child(x)]
add_frontmatter(
readme, readme_content, readme_titles, top_nav_order, bool(children)
)
Expand Down Expand Up @@ -146,12 +158,6 @@ def main() -> None:
# Ensure this runs from the repo root.
os.chdir(Path(__file__).parents[1])

# bazel-execroot interferes with jekyll because it's a broken symlink.
Path("bazel-execroot").unlink()
# This is a symlink to website/favicon.png, which is moved below.
# TODO: Consider moving the icon to a location which won't break.
Path("utils/vscode/images/icon.png").unlink()
jonmeow marked this conversation as resolved.
Show resolved Hide resolved

# The external symlink is created by scripts/create_compdb.py, and can
# interfere with local execution.
external = Path("external")
Expand All @@ -160,7 +166,7 @@ def main() -> None:

# Move files to the repo root.
for f in Path("website").iterdir():
if f.name == "README.md":
if f.name in ["README.md", ".jekyll-cache", "_site"]:
continue
f.rename(f.name)

Expand Down
Loading