Anon-Planet / thgtoa

The comprehensive guide for online anonymity and OpSec.
https://anonymousplanet.org/
Other
383 stars 41 forks source link

Stop publishing MD files on website #169

Closed ghost closed 2 years ago

ghost commented 2 years ago

Right now both HTML and MD files are published on the website:

Example: https://anonymousplanet-ng.org/about.md

This plugin will publish the HTML and then delete the MD from the published site (not from the repo)

See https://github.com/benbalter/jekyll-optional-front-matter/blob/main/README.md

ghost commented 2 years ago

Note that this is an official plugin, see https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins

ghost commented 2 years ago

Oh and you need to update your Gemfile if you are building/serving locally.

Add this line:

gem "jekyll-optional-front-matter", group: :jekyll_plugins

Run Bundle Install

nopeitsnothing commented 2 years ago

Don't you still have the includes and excludes?

ghost commented 2 years ago

Don't you still have the includes and excludes?

No because, excludes in _config.yml are exclusion from being processed by jekyll

If I exclude MD files from there, those won't be converted and published. That's why they made this plugin for. Jekyll publishes HTML and MD. Then this plugin deletes the MDs from the site.

nopeitsnothing commented 2 years ago

Then remove them from the includes?

ghost commented 2 years ago

Then remove them from the includes?

You mean #168 ?

nopeitsnothing commented 2 years ago

Then remove them from the includes?

You mean #168 ?

I'm new to Jekyll so idk if this plugin will do anything especially since you're hard declaring in the _config.yml what's to be added to the website. And why is it 2 separate PRs?

ghost commented 2 years ago

Do a bundle exec jekyll build in the root, it will build an exportable version of the site in _site/

ghost commented 2 years ago

Then you'll see HTML and MD files are published ...As they are now. This plugin (test it locally) just removes the MD files from the publishing directory.

nopeitsnothing commented 2 years ago

Then what is this doing?

include:
    - LICENSE.md
    - about.md
    - legacy.md
    - briar.md
    - .well-known
ghost commented 2 years ago

Then what is this doing?

include:
    - LICENSE.md
    - about.md
    - legacy.md
    - briar.md
    - .well-known

I don't know. I didn't do that. But sometimes Jekyll skips MD files for no reason and then you have to include them to be sure they're published. I guess that's the reason.

ghost commented 2 years ago

The include: needs to be fixed to only explicitly include files excluded by the shortlist here. Optionally, to include without specifying it in the config, we can add YAML frontmatter to the header and it will be included.

include:
    - LICENSE.md # is this necessary?
    - about.md # this is probably necessary 
    - legacy.md # don't need this
    - briar.md # need this
    - .well-known # this is just for the spec really
plugins:
  - jekyll-optional-front-matter

This also requires to update the Gemfile to add:

group :jekyll_plugins do
  gem 'jekyll-optional-front-matter'
end

I can't say this is complete without doing all that too; the plugin does nothing without those changes.

The plugin is installed on GitHub by default. No need to include it. No need for a Gemfile either. You just need to add this in your Gemfile locally if you want to build the site without the MDs in the _site directory.

As for

include:

Remove them and see if it builds correctly (meaning that corresponding HTML is present in _site or served correctly) and if yes then we should remove them yes. One by one and check.

nopeitsnothing commented 2 years ago

Looks good, resolve conflicts?

ghost commented 2 years ago

Nothing more should be needed than this