blob: 224349fa16ccbd52933a0e6a69777b9952a9f2ac [file] [log] [blame]
Russ Cox6ba27a42021-02-12 14:32:52 -05001// Copyright 2013 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
Russ Cox6ba27a42021-02-12 14:32:52 -05005// Package website exports the static content as an embed.FS.
6package website
7
8import (
Russ Cox50917542021-08-20 10:18:33 -04009 "embed"
Russ Coxa3cb3102021-08-20 10:31:05 -040010 "io/fs"
Russ Cox6ba27a42021-02-12 14:32:52 -050011)
12
Russ Coxe77adb12021-11-18 10:55:19 -050013// Content returns the go.dev website's static content.
14func Content() fs.FS {
15 return subdir(embedded, "_content")
16}
17
18// TourOnly returns the content needed only for the standalone tour.
19func TourOnly() fs.FS {
20 return subdir(tourOnly, "_content")
21}
Russ Cox6ba27a42021-02-12 14:32:52 -050022
Russ Cox40c0eef2021-11-17 22:51:08 -050023//go:embed _content
Russ Cox50917542021-08-20 10:18:33 -040024var embedded embed.FS
Russ Cox6ba27a42021-02-12 14:32:52 -050025
Russ Coxad695532021-11-22 21:57:27 -050026//go:embed _content/favicon.ico
27//go:embed _content/images/go-logo-white.svg
Hana (Hyang-Ah) Kim2918f442023-09-11 17:35:58 -040028//go:embed _content/images/icons
Russ Coxad695532021-11-22 21:57:27 -050029//go:embed _content/js/playground.js
30//go:embed _content/tour
Russ Coxe77adb12021-11-18 10:55:19 -050031var tourOnly embed.FS
32
Russ Cox6ba27a42021-02-12 14:32:52 -050033func subdir(fsys fs.FS, path string) fs.FS {
34 s, err := fs.Sub(fsys, path)
35 if err != nil {
36 panic(err)
37 }
38 return s
39}