2024年9月3日 星期二

iframe 的用法

 利用 iframe 這個 html 的 tag,就可以在網頁中顯示其它網頁的內容

<iframe src="https://yourhost.com/path/to/notebook.html" width="100%" height="600px"></iframe>


2024年9月2日 星期一

如何用 git 更新檔案

git add .

git commit -m "Update website content"

git push origin main


2024年9月1日 星期日

如何用 RStudio 做 quarto 網站,並放到 github

To deploy a Quarto website to GitHub using the usethis package in RStudio on Ubuntu 20.04, follow these steps:

  1. Install Required Packages: Ensure you have the usethis, quarto, and gitcreds packages installed. You can install them using the following commands in RStudio:

    install.packages("usethis")
    install.packages("quarto")
    install.packages("gitcreds")
    
  2. Create a New Quarto Project: Create a new Quarto project in RStudio. You can do this by navigating to File > New Project > New Directory > Quarto Website.

  3. Set git username and password (token) if you first use git:

    usethis::use_git_config(user.name = "Your Name", user.email = "your.email@example.com")
    
  4. Set git token (password), you have to get the token from github.com before use:

    gitcreds::gitcreds_set()
    
  5. Configure Quarto for GitHub Pages: Modify your _quarto.yml file to specify the output directory as docs:

    project:
      type: website
      output-dir: docs
    
  6. Build the website files:

    system("quarto render")
    
  7. Initialize Git: Initialize a Git repository in your project directory:

    usethis::use_git()
    
  8. Create a GitHub Repository: Use usethis to create a GitHub repository and link it to your local project:

    usethis::use_github()
    
  9. Configure GitHub Pages: Go to your GitHub repository settings and configure GitHub Pages to publish from the docs directory of the main branch.

如何用 RStudio 發表 Quarto 網站到 github

To deploy a Quarto website to GitHub using the usethis package in RStudio on Ubuntu 20.04, follow these steps:

  1. Install Required Packages: Ensure you have the usethis and quarto packages installed. You can install them using the following commands in RStudio:

    install.packages("usethis")
    install.packages("quarto")
    
  2. Create a New Quarto Project: Create a new Quarto project in RStudio. You can do this by navigating to File > New Project > New Directory > Quarto Website.

  3. Initialize Git: Initialize a Git repository in your project directory:

    usethis::use_git()
    
  4. Create a GitHub Repository: Use usethis to create a GitHub repository and link it to your local project:

    usethis::use_github()
    
  5. Configure Quarto for GitHub Pages: Modify your _quarto.yml file to specify the output directory as docs:

    project:
      type: website
      output-dir: docs
    
  6. Add .nojekyll File: Add a .nojekyll file to the root of your repository to prevent GitHub Pages from processing your site with Jekyll:

    touch .nojekyll
    
  7. Render and Deploy Your Site: Render your Quarto site and push the changes to GitHub:

    quarto render
    git add docs
    git commit -m "Publish site to docs/"
    git push
    
  8. Configure GitHub Pages: Go to your GitHub repository settings and configure GitHub Pages to publish from the docs directory of the main branch.