Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using 'none' footer attribute in frontmatter #1002

Merged
merged 6 commits into from
Feb 23, 2020

Conversation

yash-chowdhary
Copy link
Contributor

@yash-chowdhary yash-chowdhary commented Jan 29, 2020

What is the purpose of this pull request? (put "X" next to an item, remove the rest)

  • Enhancement to an existing feature

Fixes #638

What is the rationale for this request?

Enables users to exclude the footer that is derived/inherited from the layout specified in the <frontmatter>.

What changes did you make? (Give an overview)
Added a check for when the footer attribute is none while inserting the footer file into a Page.

Testing instructions:

  • Specify a layout in a page's <frontmatter>
  • Add footer: none to <frontmatter>
  • Build and serve site

Expected output: Footer of the derived layout is omitted

Proposed commit message: (wrap lines at 72 characters)
Allow using 'none' footer attribute in frontmatter

Copy link
Contributor

@crphang crphang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall approach seems okay.

Even though it might not be in the scope of this PR, wondering whether this functionality should only be for footer? @damithc

src/Page.js Outdated
@@ -594,6 +594,12 @@ Page.prototype.insertHeaderFile = function (pageData) {
Page.prototype.insertFooterFile = function (pageData) {
const { footer } = this.frontMatter;
let footerFile;

if (footer === 'none') {
// avoid adding any footer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment seems redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove it 👍

src/Page.js Outdated
@@ -594,6 +594,12 @@ Page.prototype.insertHeaderFile = function (pageData) {
Page.prototype.insertFooterFile = function (pageData) {
const { footer } = this.frontMatter;
let footerFile;

if (footer === 'none') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if 'none' is a keyword, put it as a constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will make the change 👍

@damithc
Copy link
Contributor

damithc commented Jan 31, 2020

Even though it might not be in the scope of this PR, wondering whether this functionality should only be for footer? @damithc

There was a suggestion to extend this to other elements. I have no objections to that. I'll leave the decision to senior devs.

@yash-chowdhary
Copy link
Contributor Author

Even though it might not be in the scope of this PR, wondering whether this functionality should only be for footer? @damithc

There was a suggestion to extend this to other elements. I have no objections to that. I'll leave the decision to senior devs.

@yamgent @acjh any suggestions?

@yamgent
Copy link
Member

yamgent commented Feb 4, 2020

@yamgent @acjh any suggestions?

Sure, feel free to add it for header, site-nav, etc...

src/Page.js Show resolved Hide resolved
@yash-chowdhary
Copy link
Contributor Author

Ready for review

@yamgent yamgent added this to the v2.11.1 milestone Feb 23, 2020
@yamgent yamgent merged commit e67dce1 into MarkBind:master Feb 23, 2020
Tejas2805 added a commit to Tejas2805/markbind that referenced this pull request Feb 27, 2020
* 'master' of https://github.com/MarkBind/markbind:
  Update tests
  Allow using 'none' footer attribute in frontmatter (MarkBind#1002)
  Support line numbers for code blocks (MarkBind#991)
  2.11.0
  Update test files due to changes in PR MarkBind#982
  Update vue-strap version to v2.0.1-markbind.36
  Make highlighting bold (MarkBind#1045)
  Support markdown for header attr in dropdown (MarkBind#1029)
  Add '_site' to the ignored folders in site.json (MarkBind#1046)
  Use path.join instead of string interpolation (MarkBind#1052)
  Implement box markdown header attributes parsing (MarkBind#1025)
  Make the position of top navbar fixed (MarkBind#982)
  Exclude *.md files from being copied over on build (MarkBind#1010)

# Conflicts:
#	docs/css/main.css
@yamgent yamgent added the pr.Enhancement 📈 Enhancement to an existing feature label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr.Enhancement 📈 Enhancement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow using an empty footer attribute in frontmatter to omit the default footer
4 participants