This is the first of a sequence of consolidations of web sites into
the single site go.dev. An accompanying blog post (next CL) will
explain the change.
The blog/_content tree moves to go.dev/_content/blog.
The *.article files were converted to *.md files using rsc.io/tmp/blog2md.
The old dot directives are now template function invocations,
so that blog content files are now exactly the same format and
semantics as regular site content files.
All the old blog redirects are carried forward, of course.
Also add exhaustive test that every .md file renders correctly.
Also rename rawhtml to raw, because it gets used for raw Markdown too.
The raw Markdown issue is working around a bigger problem
(html/template is not really right for Markdown) that we will have
to solve at some point, but not in this CL.
Change-Id: Ifa9b3b8d656a72af30d0d4e57e4c7bc8dacbc386
Reviewed-on: https://go-review.googlesource.com/c/website/+/342091
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This change adds windows/arm and windows/arm64 to the list of valid
$GOOS and $GOARCH combinations.
Fixesgolang/go#47789.
Change-Id: Iac102758f816a856f504473c623ad880caf3b72b
Reviewed-on: https://go-review.googlesource.com/c/website/+/343216
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Since we now use strings.Trim on the URL, there should be no need to check for suffix.
This change also adds a trailing / to the breadcrumb URL.
This shouldn't have much effect on the site, however for local development
non-trailing-slash paths redirected to the actual site,
which was sometimes confusing to encounter when testing changes.
Fixes https://github.com/golang/go/issues/47761
Change-Id: I25718b2c2facf460db64f5f2ef09d78dc1233857
GitHub-Last-Rev: 27ef7578b8
GitHub-Pull-Request: golang/website#80
Reviewed-on: https://go-review.googlesource.com/c/website/+/343050
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
A constant with numeric value 1, regardless of its implicit default type,
can be assigned to any "numeric" type, not just any "integer" type.
This corresponds to the examples.
Change-Id: If82fe12be245424421d9604149cf41e1e6b9ac3d
Reviewed-on: https://go-review.googlesource.com/c/website/+/342992
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
I had hoped go.dev would be running in golang-org by this point in the stack,
but it needs to keep running in go-discovery for a little bit longer.
Make that work.
Change-Id: I5e2c155e6b118ef474758fd443d519ea351bd86b
Reviewed-on: https://go-review.googlesource.com/c/website/+/342898
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Embed content, static and template directories directly in the tour
binary. This way it will work even if the package source is deleted.
The content in those directories is not large, the binary size goes
up from 14.2 MB to 15.2 MB in my testing (with Go 1.17 darwin/arm64).
Start using the Go 1.16 runtime for App Engine deployment.
Updates golang/go#44243.
Change-Id: I35fb32961cdc1edec1f8f8c0fc0193b07cef9acd
Reviewed-on: https://go-review.googlesource.com/c/website/+/342711
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
These golden tests were to prove that we were generating
the same HTML as Hugo while working on the site generator.
Now the site generator is done and we are moving on to changing content.
Change-Id: I498efe9715762a15fcd3ad31be1e1cf9db897964
Reviewed-on: https://go-review.googlesource.com/c/website/+/342092
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This CL merges go.dev/cmd/frontend into cmd/golangorg,
now that they share the same serving framework (internal/web).
Change-Id: I367d5c79b993f25ce411544b00f6db6d820290e0
Reviewed-on: https://go-review.googlesource.com/c/website/+/339404
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
- error in dl.tmpl (turns up only with access to golang-org prod database)
- adjust expected 404 error to work both locally and in prod
Change-Id: I7e5f5bd188a02936a617a427add5b8a6fbb0b80a
Reviewed-on: https://go-review.googlesource.com/c/website/+/342897
Trust: Russ Cox <rsc@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
internal/web was the framework left serving golang.org.
go.dev/cmd/internal/site was the framework serving go.dev.
This CL merges the two into a coherent, simple site serving
framework that works for both sites, a step toward merging
the sites themselves.
The CL is difficult to break up, so it's a bit larger than would be ideal.
The best place to start is the doc comment in internal/web/site.go
and then the other changes in that directory.
The rest of the CL is just minor adjustments to the repo to match.
Change-Id: I927dea29396104a817bd81b6bf25fa43f996968f
Reviewed-on: https://go-review.googlesource.com/c/website/+/339403
Trust: Russ Cox <rsc@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
There's no real need for these to be written in Go.
Change-Id: Ifb3ebc99a06bb9670a39238a1ddf370c2dcd6a22
Reviewed-on: https://go-review.googlesource.com/c/website/+/339402
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Make internal/tmplfunc available to the whole module,
as one more step toward merging internal/web and go.dev/cmd/internal/site.
Also bring in rsc.io/tmplfunc support for fs.FS.
Change-Id: I65486c32136ec500de172b8297d0605fef9d5c83
Reviewed-on: https://go-review.googlesource.com/c/website/+/339401
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Move the _templates/* function definitions nearer their uses,
allowing them to be in site.tmpl or any of the layout tmpl files.
This has the nice requirement and effect of centralizing all
the template processing now into a single function, site.renderHTML,
so that functions can be loaded from site and layout files
before the content template is executed.
And now there is no _templates directory anymore, only _content.
Change-Id: Ia74362d8d95a8e8392c9697cd404cb9ce201ae20
Reviewed-on: https://go-review.googlesource.com/c/website/+/339400
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Move _templates/layouts into _content, alongside the pages
they are layout templates for.
This lets us easily define that the default layout is
default.tmpl in the current directory, or parent, etc,
which in turn removes boilerplate from a directory
full of similar pages (like the solutions pages, but
eventually also the blog).
Change-Id: Ief31d6b7ea43d5b3faac0b0365bbcf8b797ee998
Reviewed-on: https://go-review.googlesource.com/c/website/+/339399
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Use http.RedirectHandler (forgot that existed before).
And add to validHosts so that the general golang.org doesn't kick in.
Change-Id: I80e4cd3f2324889bbda0ea42c17f73695c061abe
Reviewed-on: https://go-review.googlesource.com/c/website/+/342889
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
To be submitted once tip is being served from this app.
Change-Id: Iadcbaf83978bf636babec9a634c09f9adf7691c1
Reviewed-on: https://go-review.googlesource.com/c/website/+/339398
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
For golang/go#47719
Updates golang/go#27155
Change-Id: Ied7ea9213bd318eae7bb327a5fc29c3bc9cc812a
Co-authored-by: Matt Pearring <pearring@users.noreply.github.com>
Reviewed-on: https://go-review.googlesource.com/c/website/+/342589
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Website-Publish: DO NOT USE <dmitshur@google.com>
Change-Id: Idbb89a88af787472e48bbc3f437462842156af3f
Reviewed-on: https://go-review.googlesource.com/c/website/+/342483
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Website-Publish: DO NOT USE <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Copied from Go commit 20a620fd9f7bc35739c1af3602d53808d0430814.
deleted there in CL 342070.
Updates golang/go#44513
Change-Id: I435253feb47b222423a453c51d0c1ced30e86633
Reviewed-on: https://go-review.googlesource.com/c/website/+/342089
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
When we set up Gmail for golang.org a decade ago,
we also configured Gmail to serve m.golang.org as a shortcut
to redirect to the full Gmail URL for golang.org.
It still does, but only if you connect to http://m.golang.org/.
CL 122175 broke the m.golang.org redirect back in summer 2018
by setting an HSTS Strict-Transport-Security header with includeSubdomains,
so that visiting golang.org stops the browser from being willing to
visit http://m.golang.org/. It goes straight to https, which fails.
I have been annoyed for years that this was broken, but I wasn't sure
when it started and never took the time to track down what was wrong.
This CL fixes m.golang.org by serving the redirect ourselves.
Change-Id: I290bb2fe7fc7a415d00162776ecc54527e431c61
Reviewed-on: https://go-review.googlesource.com/c/website/+/341710
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This CL enables the code, committed in an earlier CL,
that serves tip.golang.org from an in-memory copy of the
Go repo, updated by a background loop, which will let us
retire the more heavyweight "deploy a whole new app in a loop"
that we currently use for tip.golang.org.
When this CL is committed, the "deploy a whole new app in a loop"
logic will deploy this new code, which will then start using the
in-memory copy, even though it is also being updated on each
change. At that point it will be safe to take down the app-updating
loop entirely, letting the default app do the serving.
Change-Id: Ica5cffd684c45d4a5b059772700a0a608f832bad
Reviewed-on: https://go-review.googlesource.com/c/website/+/335049
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Currently, tip.golang.org is deployed by a background loop
that fetches the latest Go and website repos every few minutes
and then does a deploy to a whole separate app.
Because this setup is different from the main app deploy,
it often gets broken by changes in the way the main app runs.
This CL removes the recurring source of breakage by making
the main app capable of serving tip.golang.org directly.
It does this by watching the main Go repo itself and downloading
a new copy of the file tree whenever there are changes.
The website repo is not watched: new changes to the website
repo already result in redeploys of the entire app when appropriate.
This CL does not actually enable the new tip.golang.org code.
A followup CL will do that, for easier rollback.
Change-Id: I015368c614579c90fa72a6699f6ab76202f87e7e
Reviewed-on: https://go-review.googlesource.com/c/website/+/328214
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This code is new and not anywhere else at the moment.
It is for a new implementation of tip.golang.org.
Change-Id: I176630816587387c08cdc53993889a5009612565
Reviewed-on: https://go-review.googlesource.com/c/website/+/328213
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
For golang/go#47397
Change-Id: I7046bddb17bdd7957603e16580e7c9bab4a8c05a
Reviewed-on: https://go-review.googlesource.com/c/website/+/339991
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Change-Id: Ie15dc10304d430d1fb3201931fc5c161581f79ea
Reviewed-on: https://go-review.googlesource.com/c/website/+/340209
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
As per the documentation: Google Cloud services such as Cloud Build and
Google Kubernetes Engine automatically check for cached images before
attempting to pull an image from Docker Hub.
Also: Only obtain cached images on mirror.gcr.io by configuring the
Docker daemon. A request to pull directly from mirror.gcr.io will fail
if a cached copy of the image does not exist.
Source: https://cloud.google.com/container-registry/docs/pulling-cached-images
Change-Id: I4320f97b016d928ea7431c56dd7486467f436a53
Reviewed-on: https://go-review.googlesource.com/c/website/+/340171
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Website-Publish: DO NOT USE <dmitshur@google.com>
Change-Id: I7650239269944f3f48876cb57174ed9ffc63c1d1
Reviewed-on: https://go-review.googlesource.com/c/website/+/340169
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Website-Publish: DO NOT USE <dmitshur@google.com>
The updated designs for go.dev no longer contain package
search. Removing search from the header ahead of time to
simplify the process of making changes to search on
pkg.go.dev.
Change-Id: I49ee684641f7e80408a339ada28fe2727d549a91
Reviewed-on: https://go-review.googlesource.com/c/website/+/336909
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Not all the package docs-specific parts of the server moved into
internal/pkgdoc before. Finish the job. Now the API for pkgdoc
is like the API for codewalk: just a NewServer that returns a handler.
Speaking of codewalk, unexport the Server type to match the
trimmed-down pkgdoc.
Change-Id: I19ba7351d55fb5d23d551a0296bb89d8abac6e9b
Reviewed-on: https://go-review.googlesource.com/c/website/+/328212
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Change-Id: Ib2316795409776a9db2dd6293b76d7c0003ba7f4
Reviewed-on: https://go-review.googlesource.com/c/website/+/335690
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
CL 317655 introduced an issue causing non-playground code examples
to be double-escaped, causing HTML escape sequences and elements
to appear in the code, such as the examples in crypto/rsa,
as reported in golang/go#46839. This change treats the code as
template.HTML rather than string after running through (*Page).Node
(which formats the code as HTML) and doing some basic transformations,
preventing this double-escaping from occurring.
Fixesgolang/go#46839
Change-Id: Id226147eb51219bd5e2db61e959519258e39a298
GitHub-Last-Rev: 81f8dc5e87
GitHub-Pull-Request: golang/website#73
Reviewed-on: https://go-review.googlesource.com/c/website/+/332889
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
Also update the list of behaviors controlled by the go directive for
Go 1.17.
Change-Id: Ie9eee13f0c43efd41f97d8d7c30a5ec354064776
Reviewed-on: https://go-review.googlesource.com/c/website/+/335141
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
On non-firefox browsers the search input is focussed
after pressing the / key to match the behavior of
pkg.go.dev.
Fixesgolang/go#42704
Change-Id: I81a804a9062f78997f3161ec86d1adcb8a911c92
Reviewed-on: https://go-review.googlesource.com/c/website/+/335669
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
As of CL 323897, the tour command and its static content are
contained in a module with a slightly different module path.
Update findRoot accordingly so it looks in the right place.
Updates golang/go#44243.
Change-Id: I5c979789440464ca3f9f99799bcc8e73db0769a3
Reviewed-on: https://go-review.googlesource.com/c/website/+/334969
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Since the golang/tour repository was emptied and the tour content
moved to x/website/tour, go-getting golang.org/x/tour no longer works.
This change updates the instructions to run the tour locally, both in
the tour welcome page and in the repository's README.
It also updates the pkg.go.dev badge link.
Fixesgolang/tour#1203
Change-Id: I1591e790ff3821dea4304f38a7ebc7867da585a6
Reviewed-on: https://go-review.googlesource.com/c/website/+/326330
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
For golang/go#36460
Change-Id: I36b3657103f069412b225356d011a19c1a10109e
Reviewed-on: https://go-review.googlesource.com/c/website/+/333629
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>