Skip to content

Commit

Permalink
Rename property to
Browse files Browse the repository at this point in the history
  • Loading branch information
pikinier20 committed Mar 15, 2022
1 parent 4b3e218 commit 07d2574
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/_blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h1>{{ page.title }}</h1>

<ul class="post-list">
{% for post in site.posts %}
{% for post in site.subpages %}
<li>
<h2>
<a href="{{ post.url }}">{{ post.title }}</a>
Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/usage/dottydoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ An example of this would be:
To be rendered as templates, each blog post should have front-matter and a
`layout` declaration.

The posts are also available in the variable `site.posts` throughout the site.
The posts are also available in the variable `site.subpages` throughout the site.
The fields of these objects are the same as in
`[BlogPost](dotty.tools.dottydoc.staticsite.BlogPost)`.

Expand Down
4 changes: 2 additions & 2 deletions docs/_layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ <h1>{{ page.title }}</h1>

<h2>Table of Contents</h2>
<ul class="table-of-contents">
{% for child in site.posts %}
{% for subpage in site.subpages %}
<li>
<a href="{{ child.url }}">{{ child.title }}</a>
<a href="{{ subpage.url }}">{{ subpage.title }}</a>
</li>
{% endfor %}
</ul>
4 changes: 2 additions & 2 deletions scaladoc/src/dotty/tools/scaladoc/site/LoadedTemplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ case class LoadedTemplate(
)

def resolveToHtml(ctx: StaticSiteContext): ResolvedPage =
val posts = children.filterNot(_.hidden).map(_.lazyTemplateProperties(ctx))
val subpages = children.filterNot(_.hidden).map(_.lazyTemplateProperties(ctx))
def getMap(key: String) = templateFile.settings.getOrElse(key, Map.empty).asInstanceOf[Map[String, Object]]

val sourceLinks = if !file.exists() then Nil else
Expand All @@ -50,7 +50,7 @@ case class LoadedTemplate(
ctx.sourceLinks.pathTo(actualPath, operation = "edit", optionalRevision = Some("master")).map("editSource" -> _)

val updatedSettings = templateFile.settings ++ ctx.projectWideProperties +
("site" -> (getMap("site") + ("posts" -> posts))) + ("urls" -> sourceLinks.toMap) +
("site" -> (getMap("site") + ("subpages" -> subpages))) + ("urls" -> sourceLinks.toMap) +
("page" -> (getMap("page") + ("title" -> templateFile.title.name)))

templateFile.resolveInner(RenderingContext(updatedSettings, ctx.layouts))(using ctx)

0 comments on commit 07d2574

Please sign in to comment.