{{template "repo/header" .}}
{{template "base/alert" .}} {{template "repo/code/recently_pushed_new_branches" .}} {{if and (not .HideRepoInfo) (not .IsBlame)}}
{{- $description := .Repository.DescriptionHTML ctx -}} {{if $description}}{{$description | RenderCodeBlock}}{{end}} {{if .Repository.Website}}{{.Repository.Website}}{{end}}
{{/* it should match the code in issue-home.js */}} {{range .Topics}}{{.Name}}{{end}} {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}{{end}}
{{end}} {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
{{end}} {{if .Repository.IsArchived}}
{{if .Repository.ArchivedUnix.IsZero}} {{ctx.Locale.Tr "repo.archive.title"}} {{else}} {{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} {{end}}
{{end}} {{template "repo/sub_menu" .}} {{$n := len .TreeNames}} {{$l := Eval $n "-" 1}} {{$isHomepage := (eq $n 0)}}
{{template "repo/branch_dropdown" dict "root" .}} {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} {{$cmpBranch := ""}} {{if ne .Repository.ID .BaseRepo.ID}} {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}} {{end}} {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}} {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}} {{svg "octicon-git-pull-request"}} {{end}} {{if $isHomepage}} {{ctx.Locale.Tr "repo.find_file.go_to_file"}} {{end}} {{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}} {{end}} {{if and $isHomepage (.Repository.IsTemplate)}} {{ctx.Locale.Tr "repo.use_template"}} {{end}} {{if $isHomepage}} {{/* only show the "code search" on the repo home page, it only does global search, so do not show it when viewing file or directory to avoid misleading users (it doesn't search in a directory) */}}
{{template "shared/search/button"}}
{{else}} {{StringUtils.EllipsisString .Repository.Name 30}} {{- range $i, $v := .TreeNames -}} / {{- if eq $i $l -}} {{$v}} {{- else -}} {{$p := index $.Paths $i}}{{$v}} {{- end -}} {{- end -}} {{end}}
{{if $isHomepage}}
{{template "repo/clone_buttons" .}} {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}}
{{template "repo/cite/cite_modal" .}} {{end}} {{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} {{end}}
{{if .IsViewFile}} {{template "repo/view_file" .}} {{else if .IsBlame}} {{template "repo/blame" .}} {{else}}{{/* IsViewDirectory */}} {{template "repo/view_list" .}} {{end}}