Skip to content

Commit 185f34f

Browse files
Merge pull request #229 from googlecodelabs/template-changes
Template changes
2 parents 1f2badf + 9070e40 commit 185f34f

File tree

6 files changed

+234
-185
lines changed

6 files changed

+234
-185
lines changed

claat/cmd/export.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ func exportCodelab(src string, opts CmdExportOptions) (*types.Meta, error) {
105105

106106
// codelab export context
107107
lastmod := types.ContextTime(clab.mod)
108+
clab.Meta.Source = src
108109
meta := &clab.Meta
109110
ctx := &types.Context{
110-
Source: src,
111111
Env: opts.Expenv,
112112
Format: opts.Tmplout,
113113
Prefix: opts.Prefix,

claat/render/template-devsite.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
{{if .Meta.Summary}}
2525
<meta name="description" content="{{.Meta.Summary}}" />
2626
{{end}}
27+
<meta name="original_source" content="https://docs.google.com/document/d/{{.Meta.Source}}/edit" />
2728
<meta name="hide_last_updated" value="true" />
2829
<meta name="hide_ratings_widget" value="true" />
2930
<meta name="page_type" value="codelab" />

claat/render/template.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@
4040
title="{{.Meta.Title}}"
4141
environment="{{index .Env}}"
4242
feedback-link="{{.Meta.Feedback}}">
43-
{{range .Steps}}{{if matchEnv .Tags $.Env}}
43+
{{range $i, $e := .Steps}}{{if matchEnv .Tags $.Env}}
4444
<google-codelab-step label="{{.Title}}" duration="{{.Duration.Minutes}}">
45+
{{if eq $i 0}}
46+
<google-codelab-about codelab-title="{{$.Meta.Title}}"
47+
{{if $.Updated}}last-updated="{{$.Updated}}"{{end}}
48+
{{if $.Meta.Authors}}authors="{{$.Meta.Authors}}"{{end}}>
49+
</google-codelab-about>
50+
{{end}}
4551
{{.Content | renderHTML $.Env}}
4652
</google-codelab-step>
4753
{{end}}{{end}}

0 commit comments

Comments
 (0)