diff --git a/portfolio/.gitignore b/portfolio/.gitignore new file mode 100644 index 000000000..9015a7a32 --- /dev/null +++ b/portfolio/.gitignore @@ -0,0 +1 @@ +index diff --git a/portfolio/index/_redirects b/portfolio/index/_redirects deleted file mode 100644 index b76da6a2f..000000000 --- a/portfolio/index/_redirects +++ /dev/null @@ -1,5 +0,0 @@ -/dla/* https://dla--cal-itp-data-analyses.netlify.app//:splat 200 -/one-hundred-recs/* https://one-hundred-recs--cal-itp-data-analyses.netlify.app//:splat 200 -/competitive-corridors/* https://competitive-corridors--cal-itp-data-analyses.netlify.app//:splat 200 -/rt/* https://rt--cal-itp-data-analyses.netlify.app//:splat 200 -/hqta/* https://hqta--cal-itp-data-analyses.netlify.app//:splat 200 diff --git a/portfolio/index/index.html b/portfolio/index/index.html deleted file mode 100644 index 13261406e..000000000 --- a/portfolio/index/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Cal-ITP Data Analyses Portfolio - - - - -

Cal-ITP Data Analysis Portfolio

-

DLA Grant Analysis

-

100 Routes to Better Buses

-

Competitive Bus Routes near State Highway Network

-

California Transit Speed Maps

-

High Quality Transit Areas

- - -

Source code can be found on GitHub.

- - \ No newline at end of file diff --git a/portfolio/portfolio.py b/portfolio/portfolio.py index 3e164f580..e1e977f9e 100644 --- a/portfolio/portfolio.py +++ b/portfolio/portfolio.py @@ -309,6 +309,9 @@ def index( site_output_dir = PORTFOLIO_DIR / Path(name) sites.append(Site(output_dir=site_output_dir, name=name, **yaml.safe_load(f))) + rendered_index_dir = "./portfolio/index" + shutil.rmtree(rendered_index_dir, ignore_errors=True) + os.makedirs(f"{rendered_index_dir}/rt/") for template in ["index.html", "_redirects"]: fname = f"./portfolio/index/{template}" with open(fname, "w") as f: @@ -329,8 +332,10 @@ def index( args.append("--prod") if deploy: - typer.secho(f"deploying with args {args}", fg=typer.colors.GREEN) + typer.secho(f"deploying with args {' '.join(args)}", fg=typer.colors.GREEN) subprocess.run(args).check_returncode() + else: + typer.secho(f"skipping deploy (may run manually): {' '.join(args)}", fg=typer.colors.YELLOW) @app.command() diff --git a/portfolio/templates/_redirects b/portfolio/templates/_redirects index 920c6f46b..cc52aee6d 100644 --- a/portfolio/templates/_redirects +++ b/portfolio/templates/_redirects @@ -1,3 +1,5 @@ {% for site in sites -%} -/{{ site.name }}/* https://{{ site.name }}--cal-itp-data-analyses.netlify.app//:splat 200 + {% if site.name != 'rt' -%} + /{{ site.name }}/* https://{{ site.name }}--cal-itp-data-analyses.netlify.app//:splat 200 + {%- endif %} {% endfor %}