Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
^README\.Rmd$
^cran-comments\.md$
^_pkgdown\.yml$
^index\.md$
^docs$
^pkgdown$
^\.github$
41 changes: 28 additions & 13 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Visit
# https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
release:
types: [published]
workflow_dispatch:

name: pkgdown
name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: pkgdown
extra-packages: any::pkgdown, local::.
needs: website

- name: Deploy package
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = TRUE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
26 changes: 16 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
Package: greta.pkgdown
Title: 'pkgdown' Templates for 'greta' Packages
Version: 0.0.0.9000
Authors@R:
Title: Bootstrap 5 'pkgdown' Template for 'greta' Packages
Version: 0.1.0
Authors@R:
person("Nicholas", "Tierney", , "nicholas.tierney@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "https://orcid.org/0000-0003-1460-8722"))
Description: This is a private template for use by 'greta' packages.
Please don't use for your own code.
Description: A shared Bootstrap 5 'pkgdown' template that gives 'greta'
extension packages a consistent look and feel: the greta purple theme,
Roboto typography, tinted code blocks, and a wordmark in the navbar. A
'greta' package uses it by setting 'template: package: greta.pkgdown' in
its '_pkgdown.yml'. This is an internal template for the 'greta' family
of packages and is not intended for general use.
License: MIT + file LICENSE
Suggests:
rmarkdown,
knitr
URL: https://github.com/greta-dev/greta.pkgdown,
https://greta-dev.github.io/greta.pkgdown/
BugReports: https://github.com/greta-dev/greta.pkgdown/issues
Suggests:
knitr,
rmarkdown
Config/testthat/edition: 3
Encoding: UTF-8
Language: es
Language: en-GB
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
URL: https://greta-dev.github.io/greta.pkgdown
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# greta.pkgdown 0.1.0

* Modernised greta.pkgdown into a standard Bootstrap 5 pkgdown template
package, following the `tidyverse/tidytemplate` layout. The shared theme now
lives in `inst/pkgdown/BS5/` (bslib purple theme, Roboto fonts, `extra.scss`,
and the navbar wordmark override), and the fork-era `content-*`, `layout-*`,
`footer`, and `pkgdown.css` files have been removed.
* Consuming greta packages opt in with `template: {package: greta.pkgdown,
bootstrap: 5}` in their `_pkgdown.yml`.

# greta.pkgdown 0.0.0.9000

* Added a `NEWS.md` file to track changes to the package.
57 changes: 45 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,59 @@

# greta.pkgdown
# greta.pkgdown

<!-- badges: start -->

[![R-CMD-check](https://github.com/greta-dev/greta.pkgdown/workflows/R-CMD-check/badge.svg)](https://github.com/greta-dev/greta.pkgdown/actions)
[![pkgdown](https://github.com/greta-dev/greta.pkgdown/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/greta-dev/greta.pkgdown/actions/workflows/pkgdown.yaml)
<!-- badges: end -->

## Overview

`greta.pkgdown` provides a custom [pkgdown](https://pkgdown.r-lib.org)
template for greta extension packages. Please don’t use it for your own package.
`greta.pkgdown` is the shared Bootstrap 5 [pkgdown](https://pkgdown.r-lib.org)
template for the [greta](https://greta-dev.github.io/greta/) family of packages.
It gives every greta package a consistent look and feel: the greta purple theme,
Roboto typography, tinted code blocks, and the greta wordmark in the navbar.

## Templates
This is an internal template for the greta family of packages. Please don't
depend on it for your own package.

For all sites, ensure that `DESCRIPTION` contains:

Config/Needs/website: greta-dev/greta.pkgdown
## How to use

### greta packages
In a greta package, add the template to `_pkgdown.yml`:

``` yaml
template:
package: greta.pkgdown
bootstrap: 5
```

and add greta.pkgdown to the website dependencies in `DESCRIPTION` so it is
installed when the site is built:

Config/Needs/website: greta-dev/greta.pkgdown

The shared theme, navbar wordmark, and SCSS are then applied automatically. Each
package keeps full control of its own navbar `left:` structure, reference index,
articles, and home page.

## What's shared

- **Theme** — bslib variables for the greta purple (`#A379CC`), a tinted code
background, and Roboto / Roboto Mono fonts.
- **Navbar wordmark** — a `templates/navbar.html` override that swaps the
package-name text for the greta wordmark image. A package can override the
image by shipping its own `name_icon_on_white.png`.
- **SCSS** — navbar and code styling plus opt-in scaffolding for a full-width
greta-style home page.

Favicons, the reference index, articles, and home-page content stay
per-package.

## Structure

The template follows the standard pkgdown template-package layout (as used by
`tidyverse/tidytemplate`):

inst/pkgdown/BS5/
├── _pkgdown.yml # shared template: theme + navbar defaults
├── extra.scss # shared SCSS
├── assets/
│ └── name_icon_on_white.png # default navbar wordmark
└── templates/
└── navbar.html # wordmark-in-navbar override
74 changes: 8 additions & 66 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,15 @@
url: https://greta-dev.github.io/greta.pkgdown
# greta.pkgdown's own site is built with its own template, so this repo also
# serves as a live demo of the shared theme.
url: https://greta-dev.github.io/greta.pkgdown/

template:
includes:
before_title: '<a href="https://greta-stats.org"><img src="https://github.com/greta-dev/greta/raw/master/logos/main_icon.png" id="hexlogo" alt="greta" width = "144px"></a>'
before_body: '<p></p><div id="header-content" class="container"><div class="row"><img id="main-icon" src="https://github.com/greta-dev/greta/raw/master/logos/main_icon.png"/></div><div class="row"><p id="main-icon-text">simple and scalable statistical modelling in R</p></div></div>'
package: greta.pkgdown
bootstrap: 5
bslib:
bg: "white"
fg: "#A379CC"
primary: "#A379CC"
navbar-brand-font-size: "2rem"
navbar-light-color: "white"
navbar-light-brand-color: "white"
navbar-light-brand-hover-color: "white"
text-muted: "white"
navbar-light-hover-color: "white"
gray-300: "#dee2e6"
border-radius: 0.5rem
btn-border-radius: 0.25rem

home:
sidebar: FALSE
title: An R package Simple and Scalable Statistical Modelling
description: >
Write statistical models in R and fit them by MCMC and optimisation on CPUs
and GPUs, using Google TensorFlow. greta lets you write your own model
like in BUGS, JAGS and Stan, except that you write models right in R, it
scales well to massive datasets, and it's easy to extend and build on. See
the website for more information, including tutorials, examples, package
documentation, and the greta forum.
sidebar: false

navbar:
structure:
left: [get_started, docs, examples, analyses, more]
right: [forum, twitter, github]
components:
get_started:
text: get started
href: articles/get_started.html
examples:
text: examples
href: articles/example_models.html
analyses:
text: analyses
menu:
- text: example analysis
href: articles/analyses/example.html
docs:
text: docs
href: reference/index.html
more:
text: more
menu:
- text: why 'greta'?
href: articles/webpages/why_greta.html
twitter:
icon: fa-twitter
href: https://twitter.com/greta_stats
aria-label: Twitter
forum:
icon: fa-comments
href: https://forum.greta-stats.org/
aria-label: Forum
github:
icon: fa-github
href: https://github.com/greta-dev/greta
aria-label: GitHub
reference:
text: Reference
href: reference/index.html
news:
text: Changelog
href: news/index.html
left: [reference, news]
right: [search, github]
55 changes: 44 additions & 11 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
<div id="head">
<p></p>
<div id="header-content" class="container">
<div class="row">
<img id="main-icon" src="reference/figures/main_icon.png" />
</div>
<div class="row">
<p id="main-icon-text">simple and scalable statistical modelling in R</p>
</div>
</div>
</div>
# greta.pkgdown

`greta.pkgdown` is the shared [pkgdown](https://pkgdown.r-lib.org) template for
the [greta](https://greta-dev.github.io/greta/) family of packages. It builds on
Bootstrap 5 and gives every greta package a consistent look and feel: the greta
purple theme, Roboto typography, tinted code blocks, and the greta wordmark in
the navbar.

This is an internal template for the greta family of packages. You are welcome
to read it for inspiration, but please don't depend on it for your own package.

## How to use

In a greta package, add the template to `_pkgdown.yml`:

``` yaml
template:
package: greta.pkgdown
bootstrap: 5
```

and add greta.pkgdown to the website dependencies in `DESCRIPTION` so it is
installed when the site is built:

Config/Needs/website: greta-dev/greta.pkgdown

That's it. The shared theme, navbar wordmark, and SCSS are applied
automatically. A package keeps full control of its own navbar `left:`
structure, reference index, articles, and home page.

## What's shared

- **Theme** — bslib variables for the greta purple (`#A379CC`), tinted code
background, and Roboto / Roboto Mono fonts.
- **Navbar wordmark** — a `templates/navbar.html` override that swaps the
package-name text for the greta wordmark image. A package can override the
image by shipping its own `name_icon_on_white.png`.
- **SCSS** — navbar and code styling plus opt-in scaffolding for a full-width
greta-style home page.

## What stays per-package

Favicons, the reference index, articles, and home-page content are specific to
each package and are not provided by this template.
35 changes: 35 additions & 0 deletions inst/pkgdown/BS5/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Shared pkgdown configuration for greta packages.
#
# This file is merged into a consuming package's own `_pkgdown.yml` when it
# sets `template: {package: greta.pkgdown}`. Only put things here that are
# genuinely shared across greta packages. Package-specific navbar entries,
# reference indexes, and home-page content belong in each consumer's own
# `_pkgdown.yml`.

template:
# Default social-media card. A consumer can override this by setting its own
# `template: opengraph: image:` pointing at one of its own figures.
opengraph:
image:
src: man/figures/name_icon_on_purple.png
alt: "greta"
# The shared greta look: purple primary, tinted code background, Roboto.
bslib:
primary: "#A379CC"
code-bg: "#f4f0f9"
base_font: {google: "Roboto"}
heading_font: {google: "Roboto"}
code_font: {google: "Roboto Mono"}

# Shared right-hand navbar entries. `search` and `github` are pkgdown
# built-ins (github is auto-derived from the package URL/BugReports); `forum`
# points at the shared greta community forum. Consumers keep their own
# `left:` structure and are free to override `right:` if needed.
navbar:
structure:
right: [search, forum, github]
components:
forum:
icon: fa-comments
href: https://forum.greta-stats.org
aria-label: greta forum
Binary file added inst/pkgdown/BS5/assets/name_icon_on_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading