### Environment Setup Script for Local Development Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/DEPLOYMENT.md A bash script to automate the setup of the local development environment, including creating a virtual environment and installing dependencies. ```bash #!/bin/bash # setup-dev-env.sh # Create virtual environment python3 -m venv venv source venv/bin/activate # Install Python dependencies pip install pyyaml requests # requests for team_query.py # Verify Hugo version hugo version # Set GitHub token if using team_query.py # export GH_TOKEN=ghp_xxxxxxxxxxxx echo "Development environment ready!" ``` -------------------------------- ### Local Development Environment Setup Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/DEPLOYMENT.md Commands to set up a local development environment, including installing required versions of Python and Hugo, and installing Python dependencies. ```bash # Install required versions python --version # Should be 3.13+ hugo version # Should be 0.152.2+ extended pip install pyyaml # Optional: Install Dart Sass (Netlify downloads it) # On macOS with Homebrew: brew install sass/sass/dart-sass # Build locally make html # Serve locally make serve ``` -------------------------------- ### Shell Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example configuration for the interactive shell section, including intro text and a link to documentation. ```yaml shell: intro: - title: Try NumPy text: Use the interactive shell to try NumPy in the browser docslink: Don't forget to check out the docs. ``` -------------------------------- ### Start Development Server with Make Source: https://github.com/numpy/numpy.org/blob/main/README.md Starts the development web server using the 'make serve' command. This is the primary way to preview website changes locally during development. ```bash make serve ``` -------------------------------- ### ArrayLibraries Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example configuration for the ArrayLibraries section, including intro text, headers, and library entries. ```yaml arraylibraries: intro: - text: NumPy's API is the starting point when libraries are written... headers: - text: Array Library - text: Capabilities & Application areas libraries: - title: Dask text: Distributed arrays and advanced parallelism... img: /images/content_images/arlib/dask.png alttext: Dask url: https://dask.org/ ``` -------------------------------- ### Example Hero Section Configuration Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md Provides an example of configuring the homepage hero section with specific text, links, and an image. ```yaml hero: title: NumPy subtitle: The fundamental package for scientific computing with Python buttontext: "Latest release: NumPy 2.4. View all releases" buttonlink: "/news/#releases" image: logo.svg ``` -------------------------------- ### CaseStudy Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example of a CaseStudy entry for the 'First Image of a Black Hole' case study. ```yaml - title: First Image of a Black Hole text: How NumPy enabled the Event Horizon Telescope to produce... img: /images/content_images/case_studies/blackhole.png alttext: First image of a black hole... url: /case-studies/blackhole-image ``` -------------------------------- ### Example Navigation Items Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md Illustrates how to configure top navigation menu items using the NavItem structure. ```yaml navbar: - title: Install url: /install - title: Documentation url: https://numpy.org/doc/stable ``` -------------------------------- ### Start Local Development Server with Make Serve Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Starts a local development server with hot reloading. Access the site at http://localhost:1313. Stop the server by pressing Ctrl+C. ```bash make serve ``` ```bash make serve BASEURL=http://localhost:1313 ``` -------------------------------- ### Install NumPy with uv Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Use uv, a modern Python package manager, for a fast and simple installation. ```bash uv pip install numpy ``` -------------------------------- ### CaseStudies Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example configuration for the CaseStudies section, featuring a title and a list of case studies. ```yaml casestudies: title: CASE STUDIES features: - title: First Image of a Black Hole text: How NumPy, together with libraries like SciPy... img: /images/content_images/case_studies/blackhole.png alttext: First image of a black hole... url: /case-studies/blackhole-image ``` -------------------------------- ### Example Navbar Logo Configuration Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md Provides an example of configuring the site's primary logo and text displayed in the top-left corner of the navbar. ```yaml navbarlogo: image: logo.svg text: NumPy link: / ``` -------------------------------- ### Install NumPy with Pip Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Install NumPy using pip, the standard Python package installer, directly into the active environment. ```bash pip install numpy ``` -------------------------------- ### Install NumPy with Conda Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Install NumPy using conda, a popular package and environment manager. This example creates and activates a new environment before installing. ```bash conda create -n my-env conda activate my-env conda install numpy ``` -------------------------------- ### Clone Repository and Start Development Server Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/QUICK_REFERENCE.md Clone the numpy.org repository, prepare submodules, and start the local development server. Visit http://localhost:1313 to see the site. ```bash git clone https://github.com/numpy/numpy.org.git cd numpy.org make prepare make serve ``` -------------------------------- ### LibraryEntry Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example of a LibraryEntry for the Dask library. ```yaml - title: Dask text: Distributed arrays and advanced parallelism for analytics, enabling performance at scale. img: /images/content_images/arlib/dask.png alttext: Dask url: https://dask.org/ ``` -------------------------------- ### Numpy.org Development Workflow Quick Start Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/INDEX.md This snippet outlines the essential steps for setting up, developing, testing, building, and deploying changes to the Numpy.org website. ```bash # 1. Setup git clone https://github.com/numpy/numpy.org.git cd numpy.org make serve # 2. Make changes # Edit content in content/en/, layouts/, etc. # 3. Test locally # Visit http://localhost:1313 # 4. Build for production make html # 5. Deploy git add . git commit -m "Description" git push origin feature-branch # Create PR, Netlify builds preview # Merge to main for production deploy ``` -------------------------------- ### Local Development Workflow Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Clone the repository, navigate to the directory, and run 'make serve' to start a local development server. The browser will automatically refresh on content edits. ```bash # Initial setup git clone https://github.com/numpy/numpy.org.git cd numpy.org make serve # Site is now running at http://localhost:1313 # Edit content files and watch browser refresh ``` -------------------------------- ### Install NumPy using a Virtual Environment with Pip Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Set up a virtual environment and install NumPy within it using pip for better dependency management. ```bash python -m venv my-env source my-env/bin/activate # macOS/Linux my-env\Scripts\activate # Windows pip install numpy ``` -------------------------------- ### Install NumPy with Homebrew (macOS) Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Install NumPy using the Homebrew package manager on macOS. ```bash brew install numpy ``` -------------------------------- ### Verify NumPy Installation Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Verify that NumPy has been installed correctly by importing it and printing its version. ```python import numpy as np print(np.__version__) ``` -------------------------------- ### Machine Learning Section Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example demonstrating the usage of the MachineLearning type, with sample content for its 'paras' field. ```yaml machinelearning: paras: - para1: NumPy forms the basis of powerful machine learning libraries... para2: Statistical techniques called ensemble methods... ``` -------------------------------- ### Example Case Studies Data Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/partials.md An example of the 'casestudies' data structure, showing how to define a case study with a title, description, image, and URL. ```yaml casestudies: title: CASE STUDIES features: - title: "First Image of a Black Hole" text: "How NumPy enabled the Event Horizon Telescope..." img: "/images/content_images/case_studies/blackhole.png" alttext: "First image of a black hole..." url: "/case-studies/blackhole-image" ``` -------------------------------- ### Visualization Section Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example of the Visualization type, featuring a preview image with its URL and alt text, and introductory content text. ```yaml visualization: images: - url: https://www.fusioncharts.com/blog/... img: /images/content_images/v_matplotlib.png alttext: A streamplot made in matplotlib content: - text: NumPy is an essential component in the burgeoning... ``` -------------------------------- ### Install NumPy with Chocolatey (Windows) Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Install NumPy using the Chocolatey package manager on Windows. ```bash choco install numpy ``` -------------------------------- ### Example Footer Configuration Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md Illustrates a complete footer configuration, including logo, social media links, and organized quick links across three columns. ```yaml footer: logo: logo.svg socialmediatitle: "" socialmedia: - link: https://github.com/numpy/numpy icon: github quicklinks: column1: title: "" links: - text: Install link: /install - text: Documentation link: https://numpy.org/doc/stable column2: links: - text: About us link: /about column3: links: - text: Get help link: /gethelp ``` -------------------------------- ### Troubleshoot Site Build Issues Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/QUICK_REFERENCE.md Verify Hugo and Python installations, ensure `pyyaml` is installed, and try regenerating the config and performing a clean build if the site fails to build. ```bash hugo version python --version pip install pyyaml python gen_config.py make clean make html ``` -------------------------------- ### Example Social Media Links Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md Shows how to configure social media links for the footer, specifying the URL and icon for each platform. ```yaml socialmedia: - link: https://github.com/numpy/numpy icon: github - link: https://www.youtube.com/@NumPy_team icon: youtube ``` -------------------------------- ### Example Array Libraries Data Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/partials.md An example of the 'arraylibraries' data structure as it might appear in a content file (e.g., content/en/tabcontents.yaml). ```yaml arraylibraries: intro: - text: "NumPy's API is the starting point when libraries are written..." headers: - text: "Array Library" - text: "Capabilities & Application areas" libraries: - title: "Dask" text: "Distributed arrays and advanced parallelism for analytics..." img: "/images/content_images/arlib/dask.png" alttext: "Dask" url: "https://dask.org/" ``` -------------------------------- ### Install NumPy with APT (Linux) Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Install NumPy using the APT package manager on Debian-based Linux distributions. ```bash sudo apt install python3-numpy ``` -------------------------------- ### Start Development Server without Make Source: https://github.com/numpy/numpy.org/blob/main/README.md Alternative method to start the development server for environments without 'make'. It involves running a Python script to generate configuration followed by the Hugo server command. ```bash python gen_config.py hugo server ``` -------------------------------- ### Scientific Domains Section Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example of the ScientificDomains type, showing introductory text and a list containing a 'Quantum Computing' domain entry. ```yaml scientificdomains: intro: - text: Nearly every scientist working in Python draws on NumPy... libraries: - title: Quantum Computing alttext: A computer chip. img: /images/content_images/sc_dom_img/quantum_computing.svg links: - url: https://qutip.org label: QuTiP ``` -------------------------------- ### Hugo Base Parameters Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example demonstrating the usage of Hugo base parameters, including color scheme, author details, images, navigation color, font settings, and Plausible analytics domain. ```yaml params: colorScheme: light author: name: "NumPy team" images: - /images/numpy-image.jpg navColor: blue font: name: "Lato" sizes: [400, 900] plausible: dataDomain: numpy.org ``` -------------------------------- ### Scientific Domain Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example of a ScientificDomain entry, specifying details for 'Quantum Computing' including its icon and related library links. ```yaml - title: Quantum Computing alttext: A computer chip. img: /images/content_images/sc_dom_img/quantum_computing.svg links: - url: https://qutip.org label: QuTiP - url: https://pyquil-docs.rigetti.com/en/stable label: PyQuil ``` -------------------------------- ### Content Frontmatter Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example of frontmatter for a Markdown file, specifying the title, meta description, draft status, and publication date. ```yaml --- title: Installation Guide description: How to install NumPy on different platforms draft: false date: 2024-01-15 --- Page content here... ``` -------------------------------- ### Install NumPy with pixi Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Use pixi, a cross-platform package manager, to add NumPy to your project. ```bash pixi add numpy ``` -------------------------------- ### Render Shell Lesson Partial Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/partials.md This partial is used to display the default code example in the interactive shell. It returns a Python code block formatted as a markdown string. ```html {{ partial "shell-lesson.html" | print | markdownify}} ``` -------------------------------- ### Extended Development Server with Make Serve-Dev Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Starts an extended development server with additional flags for active development, such as `--disableFastRender` and `--poll 1000ms`. Use this when the standard `serve` command misses changes or rebuilds are incomplete. ```bash make serve-dev ``` -------------------------------- ### Update Everything (Dependencies, Teams, Serve) Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md A comprehensive command to update Git submodules, refresh team information using a GitHub token, and start the local development server. ```bash git submodule update --remote export GH_TOKEN=ghp_xxxxxxxxxxxx make teams make serve ``` -------------------------------- ### Clean Build Artifacts with Make Clean Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Removes all build artifacts, primarily the `public/` directory and generated static site. Use this to start a fresh build or reclaim disk space. This operation is destructive. ```bash make clean ``` -------------------------------- ### Default Shell Lesson Code Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/partials.md The default Python code example provided by the shell-lesson partial. It includes instructions for users and demonstrates basic NumPy operations. ```python """ To try the examples in the browser: 1. Type code and press Shift + Enter 2. Or copy paste and click "Run" button """ import numpy as np x = np.arange(15, dtype=np.int64).reshape(3, 5) x[1:, ::2] = -99 x rng = np.random.default_rng() samples = rng.normal(size=2500) samples ``` -------------------------------- ### Netlify Build Command Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/DEPLOYMENT.md The sequence of commands executed by Netlify to build the site, including downloading Dart Sass, setting up the PATH, installing dependencies, and running the Hugo build. ```bash export DART_SASS_TARBALL="dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" && \ curl -LJO ${DART_SASS_URL}/${DART_SASS_VERSION}/${DART_SASS_TARBALL} && \ tar -xf ${DART_SASS_TARBALL} && \ rm ${DART_SASS_TARBALL} && \ export PATH=/opt/build/repo/dart-sass:$PATH && \ pip install pyyaml && \ make html ``` -------------------------------- ### Netlify Build Configuration Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/CONFIGURATION.md This TOML file defines the build environment for Netlify, specifying Python, Hugo, and Dart Sass versions, and a custom build command to install dependencies, compile Sass, and build the Hugo site. ```toml [build.environment] PYTHON_VERSION = "3.13" HUGO_VERSION = "0.152.2" DART_SASS_VERSION = "1.93.2" DART_SASS_URL = "https://github.com/sass/dart-sass/releases/download/" [build] base = "/" publish = "public" command = """ export DART_SASS_TARBALL="dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" && \ curl -LJO ${DART_SASS_URL}/${DART_SASS_VERSION}/${DART_SASS_TARBALL} && \ tar -xf ${DART_SASS_TARBALL} && \ rm ${DART_SASS_TARBALL} && \ export PATH=/opt/build/repo/dart-sass:$PATH && \ pip install pyyaml && \ make html """ [context.deploy-preview.environment] NUMPYORG_WITH_TRANSLATIONS = "1" [[plugins]] package = "netlify-plugin-checklinks" [plugins.inputs] todoPatterns = [" public/pt/user-surveys", " public/ja/user-surveys"] skipPatterns = ["https://fonts.gstatic.com", "https://fonts.googleapis.com"] ``` -------------------------------- ### Build Site for All Languages Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/QUICK_REFERENCE.md Run the development server with the `NUMPYORG_WITH_TRANSLATIONS=1` flag to include all languages in the preview. Alternatively, build a specific language site. ```bash make serve-dev NUMPYORG_WITH_TRANSLATIONS=1 ``` ```bash make html BASEURL=http://localhost:1313/pt/ ``` -------------------------------- ### Initialize Project with Make Prepare Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Initializes the project by updating git submodules and generating Hugo configuration. Use this before building or serving for the first time, or after pulling changes that update submodules. ```bash make prepare ``` -------------------------------- ### Troubleshooting ImportError Source: https://github.com/numpy/numpy.org/blob/main/content/en/install.md Example of a common ImportError message encountered when NumPy's C extensions fail to import, often due to setup issues. ```text IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy c-extensions failed. This error can happen for different reasons, often due to issues with your setup. ``` -------------------------------- ### Data Science Section Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example illustrating the DataScience type, showcasing an introduction, image references, and text blocks for examples and content. ```yaml datascience: intro: NumPy lies at the core of a rich ecosystem... image1: - img: /images/content_images/ds-landscape.png alttext: Diagram of Python Libraries... image2: - img: /images/content_images/data-science.png alttext: Diagram of three overlapping circles... examples: - text: "Extract, Transform, Load: [Pandas](...)..." content: - text: "For high data volumes, Dask and Ray..." ``` -------------------------------- ### Tabs Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md An example of how to use the Tabs type to define a section title. ```yaml tabs: title: ECOSYSTEM ``` -------------------------------- ### Build for Production Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Generate the production-ready static site. Ensure the correct BASEURL is set for the production environment. ```bash make html BASEURL=https://numpy.org ``` -------------------------------- ### Install pyyaml Dependency Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Use this command to install the pyyaml package if you encounter a 'ModuleNotFoundError'. ```bash pip install pyyaml ``` -------------------------------- ### Build Static Site for Production with Make HTML Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Builds the static site to the `public/` directory for production deployment. This is equivalent to running `hugo`. Use this before deployment or to preview the final output locally. ```bash make html ``` ```bash make html BASEURL=https://staging.numpy.org ``` -------------------------------- ### Debug Configuration Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Prepare the build environment and display the first 50 lines of the generated configuration file. Useful for debugging build configuration issues. ```bash make prepare cat config.yaml | head -50 ``` -------------------------------- ### Build and Serve Commands Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/CONFIGURATION.md Commands for generating configuration from a template, building the Hugo site, and serving it locally with live changes detection. ```bash # Generate config from template (required before build) python gen_config.py # Build site hugo # Or serve locally with changes detected hugo server -D # Build with custom base URL (for staging) make html BASEURL=https://staging.numpy.org ``` -------------------------------- ### NumPy.org Build Command Reference Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/QUICK_REFERENCE.md Lists common Make commands for serving the development server, building for production, and utility operations. ```bash # Development make serve # Start dev server make serve-dev # Dev server with full rebuild # Production make html # Build for production make html BASEURL=URL # Build with custom base URL # Utilities make prepare # Setup (init submodules, generate config) make clean # Remove build artifacts make teams # Generate team pages (needs GH_TOKEN) make help # Show all targets ``` -------------------------------- ### Full Rebuild from Scratch Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Perform a complete rebuild of the site by cleaning previous build artifacts and then generating the HTML output. ```bash make clean make html ``` -------------------------------- ### Netlify Deploy Preview Environment Variables Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/DEPLOYMENT.md Configuration for the deploy-preview context to enable all language translations for testing purposes. ```toml [context.deploy-preview.environment] NUMPYORG_WITH_TRANSLATIONS = "1" ``` -------------------------------- ### Generate Team Gallery Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/QUICK_REFERENCE.md Set your GitHub token as an environment variable and run `make teams` to generate the team gallery. Verify the output in the `content/en/teams/` directory. ```bash export GH_TOKEN=ghp_xxxxxxxxxxxx make teams ``` -------------------------------- ### Production Deployment Workflow Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Perform a local verification build using 'make clean' and 'make html', then push changes to GitHub. Netlify automatically handles the production build and deployment. ```bash # Local verification make clean make html # Verify output in public/ directory ls -la public/ # Push to GitHub git add . git commit -m "Update content" git push origin main # Netlify automatically builds using netlify.toml settings ``` -------------------------------- ### Embedded NumPy Code Example Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/partials.md An example of Python code pre-loaded into the interactive shell, demonstrating NumPy array creation and manipulation. This code is executed within the JupyterLite environment. ```python import numpy as np x = np.arange(15, dtype=np.int64).reshape(3, 5) x[1:, ::2] = -99 samples = np.random.default_rng().normal(size=2500) ``` -------------------------------- ### Netlify Branch Deploy Context Configuration Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/DEPLOYMENT.md Optional configuration to enable building for specific branches using a custom command. ```toml [context.branch-deploy] command = "make html" ``` -------------------------------- ### Perform Full Site Build Test Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/QUICK_REFERENCE.md Clean the build output, perform a full static site build, and then list the contents of the public directory to verify the build. ```bash make clean make html ls -la public/ ``` -------------------------------- ### Display Available Make Targets Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/build-system.md Lists all available Make targets and their descriptions. This is useful for understanding the project's build capabilities. ```bash make help ``` -------------------------------- ### Embedding Shortcode in Markdown Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/shortcodes.md An example of embedding a 'sponsors' shortcode within a Markdown file. ```markdown # Section Title Some introductory text. {{< sponsors >}} More content here... ``` -------------------------------- ### Root Configuration Files Overview Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/DIRECTORY_STRUCTURE.md Lists and describes the primary configuration files located at the root of the project, including Hugo, Netlify, Git, and build automation settings. ```markdown | File | Purpose | Format | |------|---------|--------| | `config.yaml.in` | Base Hugo configuration template | YAML | | `config.yaml` | Generated Hugo configuration (git-ignored) | YAML | | `netlify.toml` | Netlify build and deployment settings | TOML | | `Makefile` | Build automation targets | Makefile | | `.gitignore` | Git ignore patterns | Text | | `.gitmodules` | Git submodule configuration | Text | ``` -------------------------------- ### Data Science Type Definition Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/TYPES.md Defines the structure for data science content, including an introduction, image blocks, examples, and content paragraphs. ```yaml DataScience: intro: string image1: ImageBlock[] image2: ImageBlock[] examples: TextBlock[] content: TextBlock[] ``` -------------------------------- ### Asset Path References in Content Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/DIRECTORY_STRUCTURE.md Examples of how to reference various assets, such as images, CSS, and JavaScript, within the content and templates of the Numpy.org website. ```markdown # Images in static/ ![Alt text](/images/content_images/numpy-comic.png) # Logos ![Logo](/images/logos/berkeley-color.svg) # Case study images ![Image](/images/content_images/case_studies/blackhole.png) # CSS in assets/css/ # JavaScript in assets/js/ ``` -------------------------------- ### Development Workflow for NumPy.org Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/DEPLOYMENT.md Follow these steps to make local changes, test them, and prepare them for a pull request. Ensure you are on a feature branch before making changes. ```bash git checkout -b feature/my-changes # Edit content, layouts, config, etc. make serve # Visit http://localhost:1313 make clean make html git add . git commit -m "Add feature" git push origin feature/my-changes ``` -------------------------------- ### Hugo Extended Version Error Source: https://github.com/numpy/numpy.org/blob/main/README.md This error message indicates that the Hugo extended version is not installed. Ensure you have the extended version of Hugo to avoid this issue. ```bash error: failed to transform resource: TOCSS: failed to transform "style.sass" ``` -------------------------------- ### Call sendThankYou After Form Submission Source: https://github.com/numpy/numpy.org/blob/main/_autodocs/api-reference/frontend.md Example of how to invoke the `sendThankYou` function within a form submission's success callback, typically after an API call. ```javascript // When form submission completes successfully fetch('/api/subscribe', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { sendThankYou(); } }); ```