-
Notifications
You must be signed in to change notification settings - Fork 32
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
Properly configure Google Analytics #57
Conversation
Thanks for looking into this! As for the config hierarchy, we're not going for exact duplication of the mkdocs theme. This is because of differences in implementation details. Generally, with sphinx, extensions get their own config variables (not a sub-section/field of a another theme-specific variable). But, there is going to be confusion about where the theme stops and the patchwork of extensions begins. |
@2bndy5 how should I resolve the Black issues in the CI? The GitHub Action says
but locally it says this for me
Is there a config file I need to explicitly pass to |
I think if you run black from the repo root it should automatically use the settings in the toml file |
I don't see any specific black configuration in this repo. It might just be using a different version of black in the CI runner than what you're using locally. |
Gotcha. I literally just installed |
The CI says its uses Black 22.3.0 on Python 3.9. I have Python 3.8 and (the latest) Black 19.3b0. It might be nice if there's a way to streamline this, or make it more consistent. Perhaps a CI action that appends a commit with the black formatting? Just a thought... If I knew the |
We could have the output show a diff. I'm not very fluent on pre-commit (which is how you would go about automating black formatting). Also, it requires the dev to do frequent |
Unless I missed something, you're using an older version of black. Seems it left beta finally. Since they're using a time based symantic versioning, I'd wager 22.3.0 is newer than 19.3b0. I suppose we could also pin to a specific black version in the requirements.txt file... |
I would have thought the same... However, this is what I get. I'm guessing 19.3b0 is the latest for Python 3.8 and 22.3.0 is the latest for Python 3.9??
I can run the auto-formatter with the Black version I have, but I fear the newer(?) version will complain lol |
Oops. I just realized that the Debain package isn't going to be the latest. I ran |
oh yeah, getting updated resources from |
I think this PR is ready. Does this look good to you, @jbms? |
Maybe we should just have an I don't see a particular advantage to doing it differently. |
I added an I also updated the docs. Let me know your thoughts, or if you'd me like to change anything. |
Thanks! |
This PR fixes #48 by properly assigning the
config
dictionary with the Google Analytics property value.After some digging, I realized the Material for Mkdocs analytics code (partial) was not being added during local testing. The Google Analytics signaling I get on RTD is from custom JS added by RTD at build time.
Below is the partial looking for
config.extra.analytics
, which currently is not set.sphinx-immaterial/src/partials/integrations/analytics/google.html
Lines 23 to 30 in 3b1a1a0
I learned that the
google_analytics
configuration option has been deprecated in favor ofextra/analytics
. See here.Current PR
This PR reads the old configuration style and assigns it properly in the
config
dictionary passed to the Material for Mkdocs pages. I tested this locally and it works -- the partial is added to the page and I can receive GA reports in my account, including search terms!Future PR
However, I think it would be wise to adjust the
html_theme_options
hierarchy to match Material for Mkdocs configuration hierarchy. That is, I believe thehtml_theme_options
should be:I noticed
"social"
,"disqus"
, and"pwa_manifest"
also don't have the property hierarchy. I believe they should be nested in the"extra"
dictionary withinhtml_theme_options
.sphinx-immaterial/sphinx_immaterial/__init__.py
Lines 228 to 248 in 3b1a1a0
I'm willing to make this change and document it in a subsequent PR if you agree.