Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
eeholmes authored Feb 15, 2024
0 parents commit b3e1ebc
Show file tree
Hide file tree
Showing 66 changed files with 29,476 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/run-build-site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
name: update-distill-site

jobs:
update-distill-site:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v1

- name: Install packages
run: Rscript -e 'install.packages(c("rmarkdown", "distill", "postcards", "knitr"))'

- name: Build site
run: Rscript -e 'rmarkdown::render_site(encoding = 'UTF-8')'

- name: Set up Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
- name: Commit all changes
run: |
git add -A && git commit -m 'Build site' || echo "No changes to commit"
git push origin || echo "No changes to commit"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
.DS_Store
images/.DS_Store
*.Rproj
15 changes: 15 additions & 0 deletions 2-Training.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Website
1 change: 1 addition & 0 deletions Disclaimer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an 'as is' basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.
121 changes: 121 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
Creative Commons Legal Code

CC0 1.0 Universal

CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.

For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:

i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.

4. Limitations and Disclaimers.

a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Software code created by U.S. Government employees is not subject to copyright in the United States (17 U.S.C. §105). The United States/Department of Commerce reserves all rights to seek and obtain copyright protection in countries other than the United States for Software authored in its entirety by the Department of Commerce. To this end, the Department of Commerce hereby grants to Recipient a royalty-free, nonexclusive license to use, copy, and create derivative works of the Software outside of the United States.
28 changes: 28 additions & 0 deletions Page1.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: "Simple Page"
output:
distill::distill_article:
self_contained: false
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

## Basic

This is a basic page with no table of contents. You specify this type of page with

```
output:
distill::distill_article:
self_contained: false
```

## R code

Because this uses RMarkdown. You can have R code.

```{r echo=FALSE}
plot(1,1)
```
39 changes: 39 additions & 0 deletions Page2.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Page 2
output:
distill::distill_article:
self_contained: false
toc: true
toc_depth: 3
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

```{css}
d-title {
display: none;
}
```

# Header 1

Here the title and description is removed by passing special css for this page to create a tighter layout.

## Page with toc

You can add a table of contents to your pages. This will be taken from your headers.

### The yaml

```
output:
distill::distill_article:
self_contained: false
toc: true
toc_depth: 3
```

# Another top header

59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[![](https://img.shields.io/badge/Open%20In-RStudio%20Cloud-green)](https://rstudio.cloud/content/4772998) *Try without installing anything. Make sure to make click the Make a Copy button or you will lose all your changes.*


# NOAA distill website template

This is a distill website using RMarkdown and the postcards package to create the layout for the individual pages. Here postcards layout is only used for the index page, but you can use it for any page. See the [postcards](https://github.com/seankross/postcards) GitHub readme for the different layouts available.

The NMFS palette and fonts are being set in `css/nmfs-palette-theme.css`. You can try `css\theme.css` to see the distill default.

## GitHub set-up

* Click the green "Use This Template" button to make a repository with this content. Make sure to make your repo public (since GitHub Pages doesn't work on private repos unless you have a paid account).

* Turn on GitHub Actions under Settings > Actions > General
<img width="719" alt="image" src="https://user-images.githubusercontent.com/2545978/196808404-0c075fcf-db03-4516-88dd-3143b9fca475.png">

* Go to Settings > Actions > Pages and make sure it is set to publish from the main branch and docs folder.
<img width="646" alt="image" src="https://user-images.githubusercontent.com/2545978/196588577-563c75f0-b6fd-4311-b499-78669233f7ec.png">

* Edit the repo description and Readme to add a link to the webpage. When you edit the description, you will see the link url in the url box or you can click on the Actions tab or the Settings > Pages page to find the url of the distill website

## Edit in the browser directly

Because the GitHub Action will load R and run everything, you can just edit and add files in the browser. You can click the Actions tab to watch the progress. This is a common workflow once you have your site developed and you just need to do a quick update.

## Edit locally using RStudio

### RStudio Set-up

* First clone your new repo to your local computer. How? From RStudio, do File > New Project > Version Control > Git. Then paste the url of **your** repo.

* Install the needed packages. You only need to do this once.

```
install.packages(c("rmarkdown", "distill", "postcards", "knitr")
```

### Building the website

There is a GitHub Action that will automatically build the site whenever you edit the content on GitHub (directly or via a local change and then push).

You can build the site locally in RStudio, by going to the Build tab and clicking Build website. Don't see that? Go to Tools > Project Options > Build Tools and make sure the top dropdown says "Website".

### Customize

* `index.Rmd` will be the front page. You can change the layout by changing `postcards::trestles`
* Edit `_site.yml` to change the top navbar
* Add pages like `Page1.Rmd` and then add those to `_site.yml`
* Add your images (like logos) to `images` and a favicon to `favicon.ico`
* Push your changes back up to GitHub and the GitHub Action will rebuild the website.









8 changes: 8 additions & 0 deletions _footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div style="display: flex; justify-content: center;">
<div style="display: flex; align-items:center;">
<img src="./images/noaa-fisheries-rgb-2line-horizontal-small.png" alt="NOAA Fisheries Logo" height="75" style="padding-right: 10px"><span style=""><a href="https://www.commerce.gov/">U.S. Department of Commerce</a> &vert; <a href="https://www.noaa.gov">National Oceanographic and Atmospheric Administration</a> &vert; <a href="https://www.fisheries.noaa.gov/">NOAA Fisheries</a></span>
</div>
</div>



1 change: 1 addition & 0 deletions _header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
30 changes: 30 additions & 0 deletions _site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "."
title: "NOAA Distill Website"
description: |
NMFS R User Group events and materials
favicon: "favicon.ico"
output_dir: "docs"
base_url: https://nmfs-opensci.github.io/NOAA-distill-website
navbar:
logo:
image: images/nmfs-opensci-logo.png
search: false
right:
- text: "Home"
href: index.html
- text: "Page 1"
href: Page1.html
- text: "Page 2"
href: Page2.html
- icon: fab fa-github
href: https://github.com/nmfs-opensci/NOAA-distill-website
theme: css/nmfs-palette-theme.css
output:
distill::distill_article:
includes:
in_header:
- _header.html
collections:
posts:
categories: true
share: [twitter, linkedin]
Loading

0 comments on commit b3e1ebc

Please sign in to comment.